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:
parent
13ed70be6b
commit
d5ea7c2274
1 changed files with 3 additions and 4 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue