From 89debd57f7d250a5f7450738435f2c51c9e9deed Mon Sep 17 00:00:00 2001 From: NGPixel Date: Sat, 25 Apr 2020 02:58:00 -0400 Subject: [PATCH] fix: path chars check typo --- server/models/pages.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/models/pages.js b/server/models/pages.js index 4ab0adb6..db9b6eff 100644 --- a/server/models/pages.js +++ b/server/models/pages.js @@ -214,12 +214,12 @@ module.exports = class Page extends Model { */ static async createPage(opts) { // -> Validate path - if (opts.path.indexOf('.') >= 0 || opts.path.indexOf(' ') >= 0 || opts.path.index('\\') >= 0) { + if (opts.path.indexOf('.') >= 0 || opts.path.indexOf(' ') >= 0 || opts.path.indexOf('\\') >= 0) { throw new WIKI.Error.PageIllegalPath() } // -> Remove trailing slash - if (opts.path.endsWidth('/')) { + if (opts.path.endsWith('/')) { opts.path = opts.path.slice(0, -1) } @@ -404,12 +404,12 @@ module.exports = class Page extends Model { } // -> Validate path - if (opts.destinationPath.indexOf('.') >= 0 || opts.destinationPath.indexOf(' ') >= 0 || opts.destinationPath.index('\\') >= 0) { + if (opts.destinationPath.indexOf('.') >= 0 || opts.destinationPath.indexOf(' ') >= 0 || opts.destinationPath.indexOf('\\') >= 0) { throw new WIKI.Error.PageIllegalPath() } // -> Remove trailing slash - if (opts.destinationPath.endsWidth('/')) { + if (opts.destinationPath.endsWith('/')) { opts.destinationPath = opts.destinationPath.slice(0, -1) }