From b035fe247b6c0ca8090a4abbc991ccc9afee211c Mon Sep 17 00:00:00 2001 From: Aileen Nowak Date: Tue, 11 Apr 2017 20:09:15 +0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=20Use=20correct=20blog=20icon?= =?UTF-8?q?=20URL=20with=20subdirectory=20(#636)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- ghost/admin/app/components/gh-nav-menu.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ghost/admin/app/components/gh-nav-menu.js b/ghost/admin/app/components/gh-nav-menu.js index 4e65391373..8c1f967c16 100644 --- a/ghost/admin/app/components/gh-nav-menu.js +++ b/ghost/admin/app/components/gh-nav-menu.js @@ -11,9 +11,15 @@ export default Component.extend({ 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 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})`); }),