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