فهرست منبع

fix: page hands when attempting to create a 2 letters page

Nick 6 سال پیش
والد
کامیت
7a09601a10
1فایلهای تغییر یافته به همراه2 افزوده شده و 2 حذف شده
  1. 2 2
      server/helpers/page.js

+ 2 - 2
server/helpers/page.js

@@ -35,7 +35,7 @@ module.exports = {
     }
 
     // Strip extension
-    if (opts.stripExt) {
+    if (opts.stripExt && pathParts.length > 0) {
       const lastPart = _.last(pathParts)
       if (lastPart.indexOf('.') > 0) {
         pathParts.pop()
@@ -78,7 +78,7 @@ module.exports = {
    */
   isReservedPath(rawPath) {
     const firstSection = _.head(rawPath.split('/'))
-    if (firstSection.length === 1) {
+    if (firstSection.length <= 1) {
       return true
     } else if (localeSegmentRegex.test(firstSection)) {
       return true