diff --git a/lib/core/resolverFactory.js b/lib/core/resolverFactory.js index 6add1304..f2568951 100644 --- a/lib/core/resolverFactory.js +++ b/lib/core/resolverFactory.js @@ -60,7 +60,7 @@ function getConstructor(source, config, registryClient) { // If source is ./ or ../ or an absolute path absolutePath = path.resolve(config.cwd, source); - if (/^\.\.?[\/\\]/.test(source) || /^~\//.test(source) || path.normalize(source) === absolutePath) { + if (/^\.\.?[\/\\]/.test(source) || /^~\//.test(source) || path.normalize(source).replace(/[\/\\]+$/, '') === absolutePath) { promise = Q.nfcall(fs.stat, path.join(absolutePath, '.git')) .then(function (stats) { if (stats.isDirectory()) { diff --git a/test/core/resolverFactory.js b/test/core/resolverFactory.js index 54d05589..0f953fc3 100644 --- a/test/core/resolverFactory.js +++ b/test/core/resolverFactory.js @@ -303,6 +303,11 @@ describe('resolverFactory', function () { temp = path.resolve(__dirname, '../assets/package-a'); endpoints[temp] = temp; + // Absolute path that ends with a / + // See: https://github.com/bower/bower/issues/898 + temp = path.resolve(__dirname, '../assets/package-a') + '/'; + endpoints[temp] = temp; + // Relative path endpoints[__dirname + '/../assets/package-a'] = temp;