Skip to content

Commit

Permalink
Re-remove relative segments when prepending
Browse files Browse the repository at this point in the history
Releative segments are normally prevented by the `relative` function elsewhere in the file, when creating the asset map, but can return when persisting fragments.

Fixes ember-cli#36.
  • Loading branch information
john-kurkowski committed Jun 29, 2016
1 parent 1c9ced0 commit 415968e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ AssetRewrite.prototype.rewriteAssetPath = function (string, assetPath, replaceme
replaceString = match[1].replace(assetPath, replacementPath);

if (this.prepend && replaceString.indexOf(this.prepend) !== 0) {
var removeLeadingSlashRegex = new RegExp('^/?(.*)$');
replaceString = this.prepend + removeLeadingSlashRegex.exec(replaceString)[1];
var removeLeadingRelativeOrSlashRegex = new RegExp('^\\.*/?(.*)$');
replaceString = this.prepend + removeLeadingRelativeOrSlashRegex.exec(replaceString)[1];
}

newString = newString.replace(new RegExp(escapeRegExp(match[1]), 'g'), replaceString);
Expand Down

0 comments on commit 415968e

Please sign in to comment.