소스 검색

now redirects to <path>/ when serving a directory's index.html

master
mortie 7 년 전
부모
커밋
8f2f0886c1
1개의 변경된 파일10개의 추가작업 그리고 2개의 파일을 삭제
  1. 10
    2
      js/static.js

+ 10
- 2
js/static.js 파일 보기

@@ -93,9 +93,17 @@ module.exports = function(root, before) {
return;
}

// If it's a directory, we want the index.html file
if (stat.isDirectory())
// If it's a directory, we want the index.html file,
// or redirect to <pathname>/
if (stat.isDirectory()) {
if (pn[pn.length - 1] !== "/") {
res.writeHead(302, { location: pn + "/" });
res.end();
return;
}

path = pathlib.join(path, "index.html");
}

// Send the file
send(path);

Loading…
취소
저장