Permalink
Browse files

Fix autoindex

  • Loading branch information...
1 parent 2ab35e0 commit 6f2066e4f38cd6639bae7c3c4c2f7330069d4190 @pvorb committed Feb 16, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2 write.js
View
@@ -200,7 +200,7 @@ function autoindex(reg, conf, cb) {
// normalize dir and remove pubDir
var dirname = dir.replace(path.normalize(pubDir + '/'), '');
// normalize slashes
- dirname = dirname.replace('\\', '/');
+ dirname = dirname.replace(new RegExp('\\\\', 'g'), '/');
for (var i in conf.autoindex) {(function (index) {
if (dirname.match(new RegExp(index.pattern))) {
@@ -230,8 +230,9 @@ function autoindex(reg, conf, cb) {
if (err)
return cb(err);
var p = clone(conf.properties);
- p.__dir = dir;
+ p.__dir = dirname;
p.__files = data.files;
+ p.title = dirname.split('/').pop();
var file = path.resolve(dir, index.path);
var fileContents = ejs.render(data.tpl, { locals: p });

0 comments on commit 6f2066e

Please sign in to comment.