Commit 89debd57 authored by NGPixel's avatar NGPixel

fix: path chars check typo

parent 2dd4cf5c
...@@ -214,12 +214,12 @@ module.exports = class Page extends Model { ...@@ -214,12 +214,12 @@ module.exports = class Page extends Model {
*/ */
static async createPage(opts) { static async createPage(opts) {
// -> Validate path // -> 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() throw new WIKI.Error.PageIllegalPath()
} }
// -> Remove trailing slash // -> Remove trailing slash
if (opts.path.endsWidth('/')) { if (opts.path.endsWith('/')) {
opts.path = opts.path.slice(0, -1) opts.path = opts.path.slice(0, -1)
} }
...@@ -404,12 +404,12 @@ module.exports = class Page extends Model { ...@@ -404,12 +404,12 @@ module.exports = class Page extends Model {
} }
// -> Validate path // -> 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() throw new WIKI.Error.PageIllegalPath()
} }
// -> Remove trailing slash // -> Remove trailing slash
if (opts.destinationPath.endsWidth('/')) { if (opts.destinationPath.endsWith('/')) {
opts.destinationPath = opts.destinationPath.slice(0, -1) opts.destinationPath = opts.destinationPath.slice(0, -1)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment