mirror of
https://example.com
synced 2024-11-22 06:46:40 +09:00
fix (backend): check redirect url
This commit is contained in:
parent
3e054573da
commit
bd859b814f
1 changed files with 3 additions and 4 deletions
|
@ -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