Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fingerprint prepend mysteriously added in wrong place in ONE file only #116

Closed
abirtley opened this issue Mar 31, 2017 · 1 comment
Closed

Comments

@abirtley
Copy link

Using Ember 2.8 and broccoli-asset-rev 2.5.0. I have added a prepend when in production to point to my AWS Cloudfront distribution. Everything works fine - except that one image (and no others) gets its fingerprinted URL generated incorrectly.

Here is the html code for that image:
<img src="/assets/images/agreeing.png">

And here is what was generated:
<img src="/https://testlawfirm.settify.com.au/assets/images/agreeing-b43abdb947643080f692a1dfdebc4394.png">

(Notice the unwanted "/" at the start of the URL)

Every other image works just fine, eg:
<img src="/assets/images/telephone.png">
becomes
<img src="https://testlawfirm.settify.com.au/assets/images/telephone-affbcf79f7bf3f4765496d2fcd4ae084.png">

the assetMap.json file gave me no clues:
"assets/images/agreeing.png": "assets/images/agreeing-b43abdb947643080f692a1dfdebc4394.png", "assets/images/telephone.png": "assets/images/telephone-affbcf79f7bf3f4765496d2fcd4ae084.png",

My workaround was to remove the initial / from the one offending img's src, like so:
<img src="assets/images/agreeing.png">

But I doubt this is expected behaviour, especially as every other image in my app has a src beginning with /assets/images/

For what it's worth, ember-cli-build.js contains (relevantly) the following parameters:
params.fingerprint = { enabled: true, prepend: cdnURL + "/", generateAssetMap: true }
cdnURL in this case was https://testlawfirm.settify.com.au

Unfortunately, I have no suggestions as to how this can be reproduced, since this only happens on one image and I can't see a reason why.

@abirtley
Copy link
Author

I've figured it out - you need to be consistent in your filenames throughout the project. If in one place you write assets/images/agreeing.png but in another you write /assets/images/agreeing.png, then your second string is going to get rewritten using the rewrite value of the first string (since the first string is a subset of the second string). This leads to the incorrect slash at the start of the second rewritten URL.

I've added a suggestion in the broccoli-asset-rewrite project, and am closing this issue here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant