From 2124e95e548e943f4d4e40a2b39dda3bf32ce6b7 Mon Sep 17 00:00:00 2001 From: Hannah Wolfe Date: Wed, 13 May 2015 15:08:04 +0100 Subject: [PATCH] Fixing 'undefined' issue with ghostPaths.url.join closes #5258 --- ghost/admin/app/helpers/gh-path.js | 6 +++--- ghost/admin/app/utils/ghost-paths.js | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ghost/admin/app/helpers/gh-path.js b/ghost/admin/app/helpers/gh-path.js index 6121c76cf8..c74aa47fd3 100644 --- a/ghost/admin/app/helpers/gh-path.js +++ b/ghost/admin/app/helpers/gh-path.js @@ -1,9 +1,9 @@ import Ember from 'ember'; // Handlebars Helper {{gh-path}} // Usage: Assume 'http://www.myghostblog.org/myblog/' -// {{gh-path}} or {{gh-path ‘blog’}} for Ghost’s root (/myblog/) -// {{gh-path ‘admin’}} for Ghost’s admin root (/myblog/ghost/) -// {{gh-path ‘api’}} for Ghost’s api root (/myblog/ghost/api/v0.1/) +// {{gh-path}} or {{gh-path 'blog'}} for Ghost's root (/myblog/) +// {{gh-path 'admin'}} for Ghost's admin root (/myblog/ghost/) +// {{gh-path 'api'}} for Ghost's api root (/myblog/ghost/api/v0.1/) // {{gh-path 'admin' '/assets/hi.png'}} for resolved url (/myblog/ghost/assets/hi.png) import ghostPaths from 'ghost/utils/ghost-paths'; diff --git a/ghost/admin/app/utils/ghost-paths.js b/ghost/admin/app/utils/ghost-paths.js index 4dc741c26b..626df2711e 100644 --- a/ghost/admin/app/utils/ghost-paths.js +++ b/ghost/admin/app/utils/ghost-paths.js @@ -10,7 +10,9 @@ var makeRoute = function (root, args) { parts = Array.prototype.slice.call(args, 0); parts.forEach(function (part) { - route = [route, part.replace(slashAtStart, '').replace(slashAtEnd, '')].join('/'); + if (part) { + route = [route, part.replace(slashAtStart, '').replace(slashAtEnd, '')].join('/'); + } }); return route += '/'; };