fix(util): 修复子包URL连续斜杠过多的问题
新增逻辑将路径中3个及以上连续斜杠收敛为2个,避免破坏scheme部分,修正不规范的URL路径格式
This commit is contained in:
@@ -524,7 +524,10 @@ export const adaptSubpackageUrl = (url) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return replacePrefix(url);
|
// 兜底:把 3 个及以上的连续 `/` 收敛为 2 个,只动 path 部分(避免影响 `https://` 这种 scheme)
|
||||||
|
// 例如把 `/pages//webview///webview?x=1` 修正成 `/pages//webview//webview?x=1`
|
||||||
|
const collapsed = url.replace(/([^:])\/{3,}/g, '$1//');
|
||||||
|
return replacePrefix(collapsed);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 归一化任意路径:确保以 '/' 开头,去除 query,适配子包
|
// 归一化任意路径:确保以 '/' 开头,去除 query,适配子包
|
||||||
|
|||||||
Reference in New Issue
Block a user