fix: preserve KOC portal path in delegation links

This commit is contained in:
巫凤萍
2026-08-12 19:53:19 +08:00
parent 51934b0638
commit e05041e037
2 changed files with 6 additions and 1 deletions

View File

@@ -543,7 +543,9 @@ export default function Home() {
};
const delegationUrl = (shareToken: string) => {
const url = new URL(window.location.origin);
const url = new URL(window.location.href);
url.search = "";
url.hash = "";
url.searchParams.set("share", shareToken);
return url.toString();
};

View File

@@ -129,6 +129,9 @@ test("creates anonymous delegation bundles and reuses one-to-one backfill", asyn
assert.match(page, /action:\s*"revoke_delegation"/);
assert.match(page, /合作社转派 · 无需登录/);
assert.match(page, /"X-KOC-Delegation"/);
assert.match(page, /const url = new URL\(window\.location\.href\)/);
assert.match(page, /url\.search = ""/);
assert.doesNotMatch(page, /const url = new URL\(window\.location\.origin\)/);
assert.match(page, /url\.searchParams\.set\("share", shareToken\)/);
assert.match(page, /请保存当前分享链接/);
assert.doesNotMatch(page, /底层KOC手机号|底层KOC企微|底层KOC微信/);