Skip to content

Commit

Permalink
module: normalize path when computing cache key.
Browse files Browse the repository at this point in the history
When adding a new module to the cache, and also when querying the cache,
normalize the path so that modules don't get loaded more than once when
they are referenced by the same filename but with different case.

Fixes nodejs#7031.
  • Loading branch information
Julien Gilli committed Aug 12, 2014
1 parent 0718426 commit b687399
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ Module._findPath = function(request, paths) {

var trailingSlash = (request.slice(-1) === '/');

var cacheKey = JSON.stringify({request: request, paths: paths});
var cacheKey = JSON.stringify({ request: path.normalize(request),
paths: paths});
if (Module._pathCache[cacheKey]) {
return Module._pathCache[cacheKey];
}
Expand Down

0 comments on commit b687399

Please sign in to comment.