mirror of
https://git.joinfirefish.org/firefish/firefish.git
synced 2024-05-18 10:51:11 +02:00
fix (backend): check redirect url
This commit is contained in:
parent
e753b313da
commit
b3668f67a0
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue