Skip to content

Commit

Permalink
fix: path chars check typo
Browse files Browse the repository at this point in the history
  • Loading branch information
NGPixel committed Apr 25, 2020
1 parent 2dd4cf5 commit 89debd5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions server/models/pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -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)
}

Expand Down

0 comments on commit 89debd5

Please sign in to comment.