Node.js based forum software built for the modern web
fix: #14181, don't remove relative_path from url if it's just prefix
Barış Soner Uşaklı8477b68cbed1
diff --git a/public/src/ajaxify.js b/public/src/ajaxify.jsindex afbe759cb6..268d0c3f66 100644--- a/public/src/ajaxify.js+++ b/public/src/ajaxify.js@@ -371,10 +371,12 @@ ajaxify.widgets = { render: render };};ajaxify.removeRelativePath = function (url) {- if (config.relative_path && url.startsWith(config.relative_path.slice(1))) {- url = url.slice(config.relative_path.length - 1);- if (url.startsWith('/')) {- url = url.slice(1);+ if (config.relative_path && url) {+ const prefix = config.relative_path.slice(1);+ if (url === prefix) {+ return '';+ } else if (url.startsWith(`${prefix}/`)) {+ url = url.slice(prefix.length + 1);}}return url;