mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-26 17:38:28 +03:00
Add limit to bulk hash prefix
This commit is contained in:
@@ -32,7 +32,8 @@ export async function getRating(req: Request, res: Response): Promise<Response>
|
||||
} catch(error) {
|
||||
return res.status(400).send("Bad parameter: hashPrefixes (invalid JSON)");
|
||||
}
|
||||
if (hashPrefixes.some((hashPrefix) => !hashPrefix || !hashPrefixTester(hashPrefix))) {
|
||||
if (hashPrefixes.length === 0 || hashPrefixes.length > 75
|
||||
|| hashPrefixes.some((hashPrefix) => !hashPrefix || !hashPrefixTester(hashPrefix))) {
|
||||
return res.status(400).send("Hash prefix does not match format requirements."); // Exit early on faulty prefix
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user