Merge pull request #901 from bower/absolute-path-slash

Fix absolute paths ending with / not going through the FsResolver, fixes #898
This commit is contained in:
André Cruz
2013-10-04 05:01:38 -07:00
2 changed files with 6 additions and 1 deletions

View File

@@ -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()) {

View File

@@ -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;