main: minor bugfix

This commit is contained in:
Leon van Kammen 2024-07-12 18:08:18 +00:00
parent 0a931a8242
commit ec1e583c11
3 changed files with 15 additions and 15 deletions

View File

@ -23,8 +23,9 @@ 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
//console.dir({URI1:xrf.navigator.URI,URI2:URI})
xrf.navigator.URI = URI
let {directory,file,fragment,fileExt} = URI;

View File

@ -6,18 +6,20 @@ xrf.frag.src = function(v, opts){
if( mesh.isSRC ) return // only embed src once
// correct for relative urls
if( v.string.charAt(0) != '#' && xrf.URI.isRelative( xrf.URI.parse( v.string ) ) ){
v.string = xrf.navigator.URI.URN + v.string
}
let url = xrf.frag.src.expandURI( mesh, v.string )
let srcFrag = opts.srcFrag = xrfragment.URI.parse(url).XRF
opts.isLocal = v.string[0] == '#'
opts.isPortal = xrf.frag.src.renderAsPortal(mesh)
opts.isSRC = mesh.isSRC = true
// correct for relative urls
let url = v.string
if( v.string.charAt(0) != '#' && xrf.URI.isRelative( xrf.URI.parse( v.string ) ) ){
url = xrf.navigator.URI.URN + v.string
}
url = xrf.frag.src.expandURI( mesh, url )
let srcFrag = opts.srcFrag = xrfragment.URI.parse(url).XRF
if(xrf.debug) console.log(`src.js: instancing ${opts.isLocal?'local':'remote'} object ${url}`)
if( opts.isLocal ){

View File

@ -431,7 +431,7 @@ class URI {
directory = url.directory;
}
if (newURI.directory != null && newURI.source.charAt(0) != "#")
if (newURI.directory != null && newURI.source.charAt(0) != "#" && newURI.directory.length > 0)
{
if( newUrl.charAt(0) != '/' && newUrl.indexOf("://") == -1 ){
var stripRelative : EReg = ~/\.\/.*/;
@ -444,15 +444,12 @@ class URI {
resultURI.directory = directory;
trace("1:"+newURI.file);
trace("2:"+url.file);
if (newURI.file != null)
if (newURI.file != null && newURI.file.length > 0)
{
resultURI.file = newURI.file;
}else{
resultURI.file = url.file;
}
trace("3:"+resultURI.file);
resultURI.path = resultURI.directory + resultURI.file;