Explorar el Código

Support Host Relative URL

gilnoycloudinary hace 7 años
padre
commit
3843ca2241
Se han modificado 1 ficheros con 5 adiciones y 0 borrados
  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;

粤ICP备19079148号