Skip to content
Browse files

fix root lookup

  • Loading branch information...
1 parent f23eddb commit 21611c574b502eb615d4095424693e60d100ba38 @omphalos committed Aug 6, 2012
Showing with 4 additions and 2 deletions.
  1. +3 −1 crud-file-server.js
  2. +1 −1 package.json
View
4 crud-file-server.js
@@ -115,7 +115,9 @@ exports.handleRequest = function(vpath, path, req, res, readOnly) {
res.setHeader('Content-Type', 'text/html');
res.write('<html><body>');
for(var f = 0; f < results.length; f++) {
- res.write('<p><a href="/' + url + '/' + results[f].name + '">' + results[f].name + '</a></p>');
+ var name = results[f].name;
+ var normalized = url + '/' + (name.indexOf('//') == 0 ? name.slice(1, results.length) : name);
+ res.write('<p><a href="/' + normalized + '">' + name + '</a></p>');
}
res.end('</body></html>');
}
View
2 package.json
@@ -1,6 +1,6 @@
{
"name": "crud-file-server",
- "version": "0.1.4",
+ "version": "0.1.5",
"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 21611c5

Please sign in to comment.
Something went wrong with that request. Please try again.