mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-20 15:30:39 +01:00
Fix relative path on topic replaceState
This commit is contained in:
@@ -173,9 +173,9 @@ define('forum/topic', ['forum/pagination', 'forum/infinitescroll', 'forum/topic/
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!scrollingToPost) {
|
if (!scrollingToPost) {
|
||||||
var parts = window.location.pathname.split('/');
|
var parts = ajaxify.removeRelativePath(window.location.pathname.slice(1)).split('/');
|
||||||
var topicId = parts[2],
|
var topicId = parts[1],
|
||||||
slug = parts[3];
|
slug = parts[2];
|
||||||
var newUrl = 'topic/' + topicId + '/' + (slug ? slug : '');
|
var newUrl = 'topic/' + topicId + '/' + (slug ? slug : '');
|
||||||
if (postIndex > 0) {
|
if (postIndex > 0) {
|
||||||
newUrl += '/' + (postIndex + 1);
|
newUrl += '/' + (postIndex + 1);
|
||||||
@@ -186,7 +186,7 @@ define('forum/topic', ['forum/pagination', 'forum/infinitescroll', 'forum/topic/
|
|||||||
var search = (window.location.search ? window.location.search : '');
|
var search = (window.location.search ? window.location.search : '');
|
||||||
history.replaceState({
|
history.replaceState({
|
||||||
url: newUrl + search
|
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;
|
currentUrl = newUrl;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user