Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Commit

Permalink
Fixed default user images returning 404s
Browse files Browse the repository at this point in the history
no issue
- dropping IE11 support meant that babel/uglifyjs was able to be clever and inline the image URLs variables directly into the template strings which was then breaking the fingerprint asset rewriting resulting in files having hashes but file references in the JS not having the hash
- removing use of template strings to build the default image URLs prevents the inlining behaviour, letting the asset fingerprint plugin do it's thing correctly
  • Loading branch information
kevinansfield committed Aug 15, 2018
1 parent 065d39e commit d24bad6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/components/gh-profile-image.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default Component.extend({
this._super(...arguments);

let defaultImage = '/img/user-image.png';
this._defaultImageUrl = `${this.get('ghostPaths.assetRoot')}${defaultImage}`;
this._defaultImageUrl = this.get('ghostPaths.assetRoot').replace(/\/$/, '') + defaultImage;
this._setPlaceholderImage(this._defaultImageUrl);
},

Expand Down
4 changes: 2 additions & 2 deletions app/models/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ export default Model.extend(ValidationEngine, {
profileImageUrl: computed('ghostPaths.assetRoot', 'profileImage', function () {
// keep path separate so asset rewriting correctly picks it up
let defaultImage = '/img/user-image.png';
let defaultPath = `${this.ghostPaths.assetRoot.replace(/\/$/, '')}${defaultImage}`;
let defaultPath = this.ghostPaths.assetRoot.replace(/\/$/, '') + defaultImage;
return this.profileImage || defaultPath;
}),

coverImageUrl: computed('ghostPaths.assetRoot', 'coverImage', function () {
// keep path separate so asset rewriting correctly picks it up
let defaultImage = '/img/user-cover.png';
let defaultPath = `${this.ghostPaths.assetRoot.replace(/\/$/, '')}${defaultImage}`;
let defaultPath = this.ghostPaths.assetRoot.replace(/\/$/, '') + defaultImage;
return this.coverImage || defaultPath;
}),

Expand Down

0 comments on commit d24bad6

Please sign in to comment.