Prechádzať zdrojové kódy

fix: path chars check typo

NGPixel 5 rokov pred
rodič
commit
89debd57f7
1 zmenil súbory, kde vykonal 4 pridanie a 4 odobranie
  1. 4 4
      server/models/pages.js

+ 4 - 4
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)
     }