Skip to content

Commit

Permalink
Merge pull request #243 from matterport/mp_main
Browse files Browse the repository at this point in the history
[three] - workaround path trailing slash assumption in three/LoaderUtil
  • Loading branch information
gkjohnson authored Mar 20, 2022
2 parents f3854d1 + 46ad812 commit 25de40d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/three/B3DMLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class B3DMLoader extends B3DMLoaderBase {

// GLTFLoader assumes the working path ends in a slash
let workingPath = this.workingPath;
if ( ! /[\\/]$/.test( workingPath ) ) {
if ( ! /[\\/]$/.test( workingPath ) && workingPath.length ) {

workingPath += '/';

Expand Down
8 changes: 6 additions & 2 deletions src/three/GLTFExtensionLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,16 @@ export class GLTFExtensionLoader extends LoaderBase {

}


}

// assume any pre-registered loader has paths configured as the user desires, but if we're making
// a new loader, use the working path during parse to support relative uris on other hosts
const resourcePath = loader.resourcePath || loader.path || this.workingPath;
let resourcePath = loader.resourcePath || loader.path || this.workingPath;
if ( ! /[\\/]$/.test( resourcePath ) && resourcePath.length ) {

resourcePath += '/';

}

loader.parse( buffer, resourcePath, model => {

Expand Down

0 comments on commit 25de40d

Please sign in to comment.