From c7b308d65e52299661649a348626d2d420652f09 Mon Sep 17 00:00:00 2001 From: Charles Date: Tue, 10 Jun 2014 09:46:38 +0700 Subject: [PATCH] Fix relative path on topic replaceState --- public/src/forum/topic.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/public/src/forum/topic.js b/public/src/forum/topic.js index 7b75f00371..48bf5dbdfa 100644 --- a/public/src/forum/topic.js +++ b/public/src/forum/topic.js @@ -173,9 +173,9 @@ define('forum/topic', ['forum/pagination', 'forum/infinitescroll', 'forum/topic/ } if (!scrollingToPost) { - var parts = window.location.pathname.split('/'); - var topicId = parts[2], - slug = parts[3]; + var parts = ajaxify.removeRelativePath(window.location.pathname.slice(1)).split('/'); + var topicId = parts[1], + slug = parts[2]; var newUrl = 'topic/' + topicId + '/' + (slug ? slug : ''); if (postIndex > 0) { newUrl += '/' + (postIndex + 1); @@ -186,7 +186,7 @@ define('forum/topic', ['forum/pagination', 'forum/infinitescroll', 'forum/topic/ var search = (window.location.search ? window.location.search : ''); history.replaceState({ url: newUrl + search - }, null, window.location.protocol + '//' + window.location.host + '/' + newUrl + search); + }, null, window.location.protocol + '//' + window.location.host + RELATIVE_PATH + '/' + newUrl + search); } currentUrl = newUrl; }