1
0
Fork 1
mirror of https://example.com synced 2024-11-22 06:36:38 +09:00

fix (backend): check redirect url

This commit is contained in:
naskya 2024-03-30 19:05:00 +09:00
parent 3e054573da
commit bd859b814f
Signed by: naskya
GPG key ID: 712D413B3A9FED5C

View file

@ -83,6 +83,9 @@ export async function getResponse(args: {
});
if (args.redirect === "manual" && [301, 302, 307, 308].includes(res.status)) {
if (!isValidUrl(res.url)) {
throw new StatusError("Invalid URL", 400);
}
return res;
}
@ -94,10 +97,6 @@ export async function getResponse(args: {
);
}
if (res.redirected && !isValidUrl(res.url)) {
throw new StatusError("Invalid URL", 400);
}
return res;
}