You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2014/08/04 14:01:17 UTC

svn commit: r1615533 - /jena/Experimental/jena-fuseki2/src/main/webapp/js/app/models/fuseki-server.js

Author: andy
Date: Mon Aug  4 12:01:16 2014
New Revision: 1615533

URL: http://svn.apache.org/r1615533
Log:
Set base URL in the presence of frags and query strings

Modified:
    jena/Experimental/jena-fuseki2/src/main/webapp/js/app/models/fuseki-server.js

Modified: jena/Experimental/jena-fuseki2/src/main/webapp/js/app/models/fuseki-server.js
URL: http://svn.apache.org/viewvc/jena/Experimental/jena-fuseki2/src/main/webapp/js/app/models/fuseki-server.js?rev=1615533&r1=1615532&r2=1615533&view=diff
==============================================================================
--- jena/Experimental/jena-fuseki2/src/main/webapp/js/app/models/fuseki-server.js (original)
+++ jena/Experimental/jena-fuseki2/src/main/webapp/js/app/models/fuseki-server.js Mon Aug  4 12:01:16 2014
@@ -23,13 +23,18 @@ define(
     var FusekiServer = Backbone.Model.extend( {
       /** This initializer occurs when the module starts, not when the constructor is invoked */
       init: function( options ) {
-        /*this._baseURL = sprintf( "http://%s:%s", window.location.hostname, window.location.port );*/
-	  // The base URL is the page and includes the webapp name.
-	  // No tariling "/"
-	  var b = window.location.href ;
-	  var pat = new RegExp("/[^/]*$","") ;
-	  b = b.replace(pat, "") ;
-          this._baseURL = b ;
+        /*
+        this._baseURL = sprintf( "http://%s:%s", window.location.hostname, window.location.port );
+        */
+	// The base URL is the page and includes the webapp name.
+	// Remove everything from the last "/" (inc frag and query string)
+	// Leave it with no trailing "/"
+
+	var b = window.location.href ;
+	b = b.replace(/#[^#]*$/, "") ;
+	b = b.replace(/\?[^\?]*$/, "") ;
+	b = b.replace(/\/[^/]*$/, "") ;
+        this._baseURL = b ;
 
         this._managementURL = null;
         this.set( "selectedDatasetName", PageUtils.queryParam( "ds" ) )