0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

🐛 Use correct blog icon URL with subdirectory (#636)

refs TryGhost/Ghost#7688
- Fixes a bug in subdirectory setup where the blog icon URL would be concatenated with a double subdirectory in the URL.
- Uses `RegExp` to strip it from `settings.icon` and concat it without trailing slash.
This commit is contained in:
Aileen Nowak 2017-04-11 20:09:15 +07:00 committed by Kevin Ansfield
parent 77fb6cbee6
commit b035fe247b

View file

@ -11,9 +11,15 @@ export default Component.extend({
open: false, open: false,
navMenuIcon: computed('config.blogUrl', 'settings.icon', function () { navMenuIcon: computed('config.blogUrl', 'settings.icon', 'ghostPaths.subdir', 'ghostPaths.url', function () {
let subdirRegExp = new RegExp(`^${this.get('ghostPaths.subdir')}`);
let blogIcon = this.get('settings.icon') ? this.get('settings.icon') : 'favicon.ico'; let blogIcon = this.get('settings.icon') ? this.get('settings.icon') : 'favicon.ico';
let url = `${this.get('config.blogUrl')}/${blogIcon}`; let url;
blogIcon = blogIcon.replace(subdirRegExp, '');
url = this.get('ghostPaths.url').join(this.get('config.blogUrl'), blogIcon).replace(/\/$/, '');
url += `?t=${(new Date()).valueOf()}`;
return htmlSafe(`background-image: url(${url})`); return htmlSafe(`background-image: url(${url})`);
}), }),