From 1ee47d321a862f15f97e2d310c9374b8aa6a2dfb Mon Sep 17 00:00:00 2001 From: cyfung1031 <44498510+cyfung1031@users.noreply.github.com> Date: Sun, 24 Aug 2025 00:47:29 +0900 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20finalUrl=E7=BC=BA=E5=A4=B1?= =?UTF-8?q?=E5=9F=9F=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/service/service_worker/gm_api.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/app/service/service_worker/gm_api.ts b/src/app/service/service_worker/gm_api.ts index 26b9902b4..029e9b4d8 100644 --- a/src/app/service/service_worker/gm_api.ts +++ b/src/app/service/service_worker/gm_api.ts @@ -1192,7 +1192,18 @@ export default class GMApi { details.responseHeaders?.forEach((header) => { if (header.name.toLowerCase() === "location") { // 重定向 - location = header.value || ""; + if (header.value) { + try { + // https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Location + // May be relative to the request URL or an absolute URL. + const url = new URL(header.value, details.url); + if (url.href) { + location = url.href; + } + } catch { + // ignore + } + } } }); if (location) {