mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-26 17:38:28 +03:00
made 400/404 behaviour consistent with API docs
This commit is contained in:
@@ -44,12 +44,14 @@ async function handleGetSegmentInfo(req: Request, res: Response) {
|
||||
return false;
|
||||
}
|
||||
const DBSegments = await getSegmentsByUUID(UUIDs);
|
||||
if (DBSegments === null || DBSegments === undefined) {
|
||||
// all uuids failed lookup
|
||||
if (DBSegments.length === 0) {
|
||||
res.sendStatus(400);
|
||||
return false;
|
||||
}
|
||||
if (DBSegments.length === 0) {
|
||||
res.sendStatus(404);
|
||||
// uuids valid but not found
|
||||
if (DBSegments[0] === null || DBSegments[0] === undefined) {
|
||||
res.sendStatus(400);
|
||||
return false;
|
||||
}
|
||||
return DBSegments;
|
||||
|
||||
Reference in New Issue
Block a user