瀏覽代碼

don't remove trailing slash for root path

jomo 10 年之前
父節點
當前提交
efd9c0ccee
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      lib/server.js

+ 1 - 1
lib/server.js

@@ -45,7 +45,7 @@ function request_id() {
 // the path is resolved and decoded
 // the path is resolved and decoded
 function path_list(pathname) {
 function path_list(pathname) {
   // remove double and trailing slashes
   // remove double and trailing slashes
-  pathname = pathname.replace(/\/\/+/g, "/").replace(/\/$/, "");
+  pathname = pathname.replace(/\/\/+/g, "/").replace(/(.)\/$/, "$1");
   var list = pathname.split("/");
   var list = pathname.split("/");
   list.shift();
   list.shift();
   for (var i = 0; i < list.length; i++) {
   for (var i = 0; i < list.length; i++) {