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

Fixing overzealous trailing-slashes

refs #4989

- Don't add a trailing a slash if the url is a file or anchor
This commit is contained in:
Hannah Wolfe 2015-03-07 21:09:50 +00:00
parent 4d5c63e4df
commit a196d81778

View file

@ -128,8 +128,9 @@ NavigationController = Ember.Controller.extend({
url = match[1];
// if the last char is not a slash, then add one,
// as long as there is no # or . in the URL (anchor or file extension)
// this also handles the empty case for the homepage
if (url[url.length - 1] !== '/') {
if (url[url.length - 1] !== '/' && url.indexOf('#') === -1 && url.indexOf('.') === -1) {
url += '/';
}
} else if (!validator.isURL(url) && url !== '' && url[0] !== '/') {