Close GH-679: Prevent renaming of bower.json/component.json to index.json, fixes #674..

This commit is contained in:
André Cruz
2013-07-29 23:41:55 +01:00
parent 44308fa026
commit d237522e8c
6 changed files with 61 additions and 2 deletions

View File

@@ -113,7 +113,8 @@ FsResolver.prototype._rename = function () {
// before checking its length
files = files.filter(junk.isnt);
if (files.length === 1) {
// Only rename if there's only one file and it's not the json
if (files.length === 1 && !/^(bower|component)\.json$/.test(files[0])) {
file = files[0];
this._singleFile = 'index' + path.extname(file);
oldPath = path.join(this._tempDir, file);

View File

@@ -232,7 +232,8 @@ UrlResolver.prototype._rename = function () {
// before checking its length
files = files.filter(junk.isnt);
if (files.length === 1) {
// Only rename if there's only one file and it's not the json
if (files.length === 1 && !/^(component|bower)\.json$/.test(files[0])) {
file = files[0];
this._singleFile = 'index' + path.extname(file);
oldPath = path.join(this._tempDir, file);