We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4b1a5de commit 3ed018aCopy full SHA for 3ed018a
1 file changed
src/app/service/service_worker/gm_api.ts
@@ -1192,7 +1192,18 @@ export default class GMApi {
1192
details.responseHeaders?.forEach((header) => {
1193
if (header.name.toLowerCase() === "location") {
1194
// 重定向
1195
- location = header.value || "";
+ if (header.value) {
1196
+ try {
1197
+ // https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Location
1198
+ // <url> May be relative to the request URL or an absolute URL.
1199
+ const url = new URL(header.value, details.url);
1200
+ if (url.href) {
1201
+ location = url.href;
1202
+ }
1203
+ } catch {
1204
+ // ignore
1205
1206
1207
}
1208
});
1209
if (location) {
0 commit comments