1
Fork 0
mirror of https://github.com/diced/zipline.git synced 2025-04-11 23:31:17 -05:00

fix: I'll just regex it.

This commit is contained in:
Jayvin Hernandez 2025-02-02 17:37:03 -08:00
parent 13ed70be6b
commit d5ea7c2274
No known key found for this signature in database
GPG key ID: 97C2E533F17AF0EB

View file

@ -278,18 +278,17 @@ export default function validate(config): Config {
}
}
const reserved = ['/view', '/dashboard', '/code', '/folder', '/api', '/auth', '/r'];
if (reserved.some((r) => validated.uploader.route.startsWith(r))) {
const reserved = new RegExp(/^\/(view|code|folder|auth|r)(\/\S*)?$|^\/(api|dashboard)(\/\S*)*/);
if (reserved.exec(validated.uploader.route))
throw {
errors: [`The uploader route cannot be ${validated.uploader.route}, this is a reserved route.`],
show: true,
};
} else if (reserved.some((r) => validated.urls.route.startsWith(r))) {
if (reserved.exec(validated.urls.route))
throw {
errors: [`The urls route cannot be ${validated.urls.route}, this is a reserved route.`],
show: true,
};
}
return validated as unknown as Config;
} catch (e) {