Permalink
Browse files

additional fix for dir

  • Loading branch information...
1 parent aa5c700 commit b04fb3aced2d038f2671882ce88f8e56ac8ae205 @omphalos committed Aug 7, 2012
Showing with 4 additions and 4 deletions.
  1. +3 −3 crud-file-server.js
  2. +1 −1 package.json
View
@@ -123,9 +123,9 @@ exports.handleRequest = function(vpath, path, req, res, readOnly, logHeadRequest
res.write('<html><body>');
for(var f = 0; f < results.length; f++) {
var name = results[f].name;
- var normalized = url + '/' + (name.indexOf('/') == 0 ? name.slice(1, results.length) : name);
- console.log('*' + normalized);
- res.write('\r\n<p><a href="' + normalized + '">' + name + '</a></p>');
+ var normalized = url + '/' + name;
+ while(normalized[0] == '/') { normalized = normalized.slice(1, normalized.length); }
+ res.write('\r\n<p><a href="/' + normalized + '">' + name + '</a></p>');
}
res.end('\r\n</body></html>');
}
View
@@ -1,6 +1,6 @@
{
"name": "crud-file-server",
- "version": "0.1.8",
+ "version": "0.1.9",
"description": "file server supporting basic create, read, update, & delete for any kind of file",
"bin": {
"crud-file-server": "./bin/crud-file-server"

0 comments on commit b04fb3a

Please sign in to comment.