fix: preserve custom scheme jump links

This commit is contained in:
杨豪
2026-09-01 12:22:47 +08:00
parent 460e30c023
commit cd819be57c
+6
View File
@@ -8,6 +8,12 @@
// 构建带参数的目标URL函数 // 构建带参数的目标URL函数
function buildTargetUrl(baseUrl) { function buildTargetUrl(baseUrl) {
try { try {
// 自定义 scheme(如 weixin://)不能通过 URL 重新序列化,
// 否则 path 中的 / 会被编码,落地页参数也可能污染目标链接。
if (!/^https?:/i.test(baseUrl)) {
return baseUrl;
}
const targetUrl = new URL(baseUrl); const targetUrl = new URL(baseUrl);
// 将当前页面的所有参数添加到目标URL中(除了jwid和key,避免冲突) // 将当前页面的所有参数添加到目标URL中(除了jwid和key,避免冲突)
for (const [key, value] of allParams) { for (const [key, value] of allParams) {