diff --git a/src/3rd/js/three/navigator.js b/src/3rd/js/three/navigator.js index d568722..de21129 100644 --- a/src/3rd/js/three/navigator.js +++ b/src/3rd/js/three/navigator.js @@ -23,6 +23,8 @@ xrf.navigator.to = (url,flags,loader,data) => { URI.duplicatePos = URI.source == xrf.navigator.URI.source && URI.hasPos URI.hashChange = String(xrf.navigator.URI.fragment||"") != String(URI.fragment||"") let hashbus = xrf.hashbus + console.dir({URI1:xrf.navigator.URI,URI2:URI}) + debugger xrf.navigator.URI = URI let {directory,file,fragment,fileExt} = URI; diff --git a/src/spec/url.json b/src/spec/url.json index 136dbf0..0332ad9 100644 --- a/src/spec/url.json +++ b/src/spec/url.json @@ -19,5 +19,6 @@ {"fn":"url","data":"a/b#foo=bar", "expect":{ "fn":"testURL", "input":"hash.foo","out":"bar"},"label":"test URL hash #mycustom == foo"}, {"fn":"url","data":"./../../xyz", "expect":{ "fn":"testURLBrowse", "input":"path","out":"/bar/flop/c/d/./../../xyz"},"label":"test URL relative path"}, {"fn":"url","data":"./../../xyz", "expect":{ "fn":"testURLBrowse", "input":"path","out":"/bar/flop/c/d/./../../xyz"},"label":"test URL relative path"}, + {"fn":"url","data":"#foo", "expect":{ "fn":"testURLBrowse", "input":"directory","out":"/bar/flop/c/d/./../../xyz"},"label":"test URL relative path"}, {"fn":"url","data":"a/b?index.glb#foo=bar://foo/flop.gltf", "expect":{ "fn":"testURL", "input":"directory","out":"/a/b"},"label":"test URLhash with protocol"} ] diff --git a/src/xrfragment/URI.hx b/src/xrfragment/URI.hx index 0f21952..9bb3f24 100644 --- a/src/xrfragment/URI.hx +++ b/src/xrfragment/URI.hx @@ -125,7 +125,7 @@ class URI { // The almighty regexp (courtesy of http://blog.stevenlevithan.com/archives/parseuri) var r : EReg = ~/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/; - if( stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != '/' ){ + if( stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != '/' && stringUrl.charAt(0) != '#' ){ stringUrl = "/" + stringUrl; // workaround for relative urls } @@ -431,7 +431,7 @@ class URI { directory = url.directory; } - if (newURI.directory != null) + if (newURI.directory != null && newURI.source.charAt(0) != "#") { if( newUrl.charAt(0) != '/' && newUrl.indexOf("://") == -1 ){ var stripRelative : EReg = ~/\.\/.*/; @@ -443,13 +443,16 @@ class URI { } resultURI.directory = directory; - + + trace("1:"+newURI.file); + trace("2:"+url.file); if (newURI.file != null) { resultURI.file = newURI.file; }else{ resultURI.file = url.file; } + trace("3:"+resultURI.file); resultURI.path = resultURI.directory + resultURI.file;