From 3cf240ada86597c629b54f4c97bdbed9e7255bdf Mon Sep 17 00:00:00 2001 From: Wojciech Kocjan Date: Tue, 9 Apr 2013 12:12:27 +0200 Subject: [PATCH] Detect and remove prefix being added twice when going to pages already in history. --- .../javascripts/discourse/routes/discourse_location.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/assets/javascripts/discourse/routes/discourse_location.js b/app/assets/javascripts/discourse/routes/discourse_location.js index 82dcd0031..26fbd0b6f 100644 --- a/app/assets/javascripts/discourse/routes/discourse_location.js +++ b/app/assets/javascripts/discourse/routes/discourse_location.js @@ -174,6 +174,13 @@ Ember.DiscourseLocation = Ember.Object.extend({ rootURL = rootURL.replace(/\/$/, ''); } + // remove prefix from URL if it is already in url - i.e. /discourse/t/... -> /t/if rootURL is /discourse + // this sometimes happens when navigating to already visited location + if ((rootURL.length > 1) && (url.substring(0, rootURL.length + 1) === (rootURL + "/"))) + { + url = url.substring(rootURL.length); + } + return rootURL + url; },