mirror of
https://github.com/codex-team/codex.docs.git
synced 2025-08-08 15:05:26 +02:00
Added server validation for uri
This commit is contained in:
parent
39a0d74042
commit
9cb14c6520
2 changed files with 5 additions and 1 deletions
|
@ -114,6 +114,11 @@ class Pages {
|
||||||
if (!page._id) {
|
if (!page._id) {
|
||||||
throw new Error('Page with given id does not exist');
|
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;
|
const previousUri = page.uri;
|
||||||
|
|
||||||
page.data = data;
|
page.data = data;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
const {pages: pagesDb} = require('../utils/database/index');
|
const {pages: pagesDb} = require('../utils/database/index');
|
||||||
const {aliases: aliasesDb} = require('../utils/database/index');
|
|
||||||
const translateString = require('../utils/translation');
|
const translateString = require('../utils/translation');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue