mirror of
https://github.com/bower/bower.git
synced 2026-01-15 01:08:07 -05:00
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:
@@ -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()) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user