You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by li...@apache.org on 2010/08/11 17:58:32 UTC

svn commit: r984456 - /shindig/trunk/features/src/main/javascript/features/rpc/rpc.js

Author: lindner
Date: Wed Aug 11 15:58:32 2010
New Revision: 984456

URL: http://svn.apache.org/viewvc?rev=984456&view=rev
Log:
SHINDIG-1330 | Patch from Javier Pedemonte | make relay URIs absolute, if relative

Modified:
    shindig/trunk/features/src/main/javascript/features/rpc/rpc.js

Modified: shindig/trunk/features/src/main/javascript/features/rpc/rpc.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/rpc/rpc.js?rev=984456&r1=984455&r2=984456&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/rpc/rpc.js (original)
+++ shindig/trunk/features/src/main/javascript/features/rpc/rpc.js Wed Aug 11 15:58:32 2010
@@ -782,8 +782,12 @@ gadgets.rpc = function() {
     getRelayUrl: function(targetId) {
       var url = relayUrl[targetId];
       // Some RPC methods (wpm, for one) are unhappy with schemeless URLs.
-      if (url && url.indexOf('//') == 0) {
-        url = document.location.protocol + url;
+      if (url && url.substring(0,1) === '/') {
+        if (url.substring(1,2) === '/') {    // starts with '//'
+          url = document.location.protocol + url;
+        } else {    // relative URL, starts with '/'
+          url = document.location.protocol + '//' + document.location.host + url;
+        }
       }
       
       return url;