1
0
Fork 0
mirror of https://github.com/codex-team/codex.docs.git synced 2025-08-08 06:55:26 +02:00

Added server validation for uri

This commit is contained in:
DorofeevMark 2019-01-13 00:48:59 +03:00
parent 39a0d74042
commit 9cb14c6520
2 changed files with 5 additions and 1 deletions

View file

@ -114,6 +114,11 @@ class Pages {
if (!page._id) {
throw new Error('Page with given id does not exist');
}
if (!data.uri.match(/^[a-z0-9'-]+$/i)) {
throw new Error('Uri has unexpected characters');
}
const previousUri = page.uri;
page.data = data;

View file

@ -1,5 +1,4 @@
const {pages: pagesDb} = require('../utils/database/index');
const {aliases: aliasesDb} = require('../utils/database/index');
const translateString = require('../utils/translation');
/**