diff --git a/src/controllers/pages.js b/src/controllers/pages.js index 14c6cfc..6c2374e 100644 --- a/src/controllers/pages.js +++ b/src/controllers/pages.js @@ -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; diff --git a/src/models/page.js b/src/models/page.js index 793c058..65b75aa 100644 --- a/src/models/page.js +++ b/src/models/page.js @@ -1,5 +1,4 @@ const {pages: pagesDb} = require('../utils/database/index'); -const {aliases: aliasesDb} = require('../utils/database/index'); const translateString = require('../utils/translation'); /**