@kimap/indoor-positioning-sdk-vue2 4.2.4 → 4.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/KMUtil.js +1 -0
- package/src/core/KimapSDK.js +5 -7
- package/src/core/SceneCore.js +5 -7
package/package.json
CHANGED
package/src/KMUtil.js
CHANGED
package/src/core/KimapSDK.js
CHANGED
|
@@ -852,19 +852,17 @@ KimapSDK.prototype._loadSingleFurniture = function(furniture, serverUrl) {
|
|
|
852
852
|
|
|
853
853
|
// 等待loader加载完成后再加载模型
|
|
854
854
|
loaderPromise.then(function(loader) {
|
|
855
|
-
// 先验证URL
|
|
855
|
+
// 先验证URL是否返回HTML(只拦截HTML,允许404等错误通过)
|
|
856
856
|
return fetch(modelUrl, { method: 'HEAD' })
|
|
857
857
|
.then(function(response) {
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
}
|
|
861
|
-
|
|
858
|
+
// 只检查Content-Type,不检查HTTP状态码
|
|
859
|
+
// 404等错误让OBJLoader自己处理
|
|
862
860
|
var contentType = response.headers.get('content-type');
|
|
863
|
-
if (contentType && contentType.includes('text/html')) {
|
|
861
|
+
if (response.ok && contentType && contentType.includes('text/html')) {
|
|
864
862
|
throw new Error('URL返回HTML而不是3D模型文件: ' + modelUrl);
|
|
865
863
|
}
|
|
866
864
|
|
|
867
|
-
//
|
|
865
|
+
// 验证通过或404等错误,继续加载(让loader处理)
|
|
868
866
|
return new Promise(function(resolveLoad, rejectLoad) {
|
|
869
867
|
loader.load(
|
|
870
868
|
modelUrl,
|
package/src/core/SceneCore.js
CHANGED
|
@@ -407,19 +407,17 @@ SceneCore.prototype._loadOBJFile = function(url, objLoader, resolve, reject) {
|
|
|
407
407
|
|
|
408
408
|
console.log('加载OBJ文件...', url);
|
|
409
409
|
|
|
410
|
-
// 先验证URL
|
|
410
|
+
// 先验证URL是否返回HTML(只拦截HTML,允许404等错误通过)
|
|
411
411
|
fetch(url, { method: 'HEAD' })
|
|
412
412
|
.then(function(response) {
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
}
|
|
416
|
-
|
|
413
|
+
// 只检查Content-Type,不检查HTTP状态码
|
|
414
|
+
// 404等错误让OBJLoader自己处理
|
|
417
415
|
var contentType = response.headers.get('content-type');
|
|
418
|
-
if (contentType && contentType.includes('text/html')) {
|
|
416
|
+
if (response.ok && contentType && contentType.includes('text/html')) {
|
|
419
417
|
throw new Error('URL返回的是HTML页面而不是OBJ文件,请检查URL是否正确');
|
|
420
418
|
}
|
|
421
419
|
|
|
422
|
-
//
|
|
420
|
+
// 验证通过或404等错误,继续加载(让loader处理)
|
|
423
421
|
objLoader.load(
|
|
424
422
|
url,
|
|
425
423
|
function(object) {
|