Skip to content

Commit

Permalink
Normalize relative path for document-root on Windows
Browse files Browse the repository at this point in the history
- Calling resolve() doesn't fully normalize relative path on Windows (in Node v0.11.x, see
  nodejs/node-v0.x-archive#7031 ), i.e. doesn't lowercase drive letter, while normalize() does, which causes
  paths resulting from calling normalize() and join() (depending on normalize()) to differ and to
  break comparisons.

Fixes cloudhead#42.
  • Loading branch information
mrfabbri committed Jun 18, 2014
1 parent 7f655b1 commit 4220671
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/node-static.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ var version = [0, 7, 3];
Server = function (root, options) {
if (root && (typeof(root) === 'object')) { options = root; root = null }

this.root = path.resolve(root || '.');
// resolve() doesn't normalize (to lowercase) drive letters on Windows
this.root = path.normalize(path.resolve(root || '.'));
this.options = options || {};
this.cache = 3600;

Expand Down

0 comments on commit 4220671

Please sign in to comment.