Selaa lähdekoodia

Support Host Relative URL

gilnoycloudinary 7 vuotta sitten
vanhempi
sitoutus
3843ca2241
1 muutettua tiedostoa jossa 5 lisäystä ja 0 poistoa
  1. 5 0
      examples/js/loaders/GLTFLoader.js

+ 5 - 0
examples/js/loaders/GLTFLoader.js

@@ -1246,6 +1246,11 @@ THREE.GLTFLoader = ( function () {
 
 		// Invalid URL
 		if ( typeof url !== 'string' || url === '' ) return '';
+		
+		// Host Relative URL
+		if (/^https?:\/\//i.test(path) && /^\//.test(url)) {
+      			path = path.replace(/(^https?:\/\/[^\/]+).*/i, "$1");
+		}
 
 		// Absolute URL http://,https://,//
 		if ( /^(https?:)?\/\//i.test( url ) ) return url;