From db48b9527d2169fec3d69cb9e637304ce68b90c3 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Fri, 30 Apr 2021 12:02:15 -0400 Subject: [PATCH] fix: #9519 unable to properly ajaxify to home on subfolder installs if anchor did not have a trailing slash --- public/src/ajaxify.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/src/ajaxify.js b/public/src/ajaxify.js index af52676726..883c0f12a7 100644 --- a/public/src/ajaxify.js +++ b/public/src/ajaxify.js @@ -473,10 +473,11 @@ $(document).ready(function () { var href = $this.attr('href'); var internalLink = utils.isInternalURI(this, window.location, config.relative_path); + const rootAndPath = new RegExp(`^${rootUrl}${config.relative_path}/?`); var process = function () { if (!e.ctrlKey && !e.shiftKey && !e.metaKey && e.which === 1) { if (internalLink) { - var pathname = this.href.replace(rootUrl + config.relative_path + '/', ''); + var pathname = this.href.replace(rootAndPath, ''); // Special handling for urls with hashes if (window.location.pathname === this.pathname && this.hash.length) {