From 1614b338f14f0e3529aafdc1d7c7fa157794f233 Mon Sep 17 00:00:00 2001
From: Xiao Gui <xgui3783@gmail.com>
Date: Tue, 1 Mar 2022 09:18:50 +0100
Subject: [PATCH] fix saneUrl extra path

---
 deploy/saneUrl/index.js | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/deploy/saneUrl/index.js b/deploy/saneUrl/index.js
index 010f28e87..973fb977c 100644
--- a/deploy/saneUrl/index.js
+++ b/deploy/saneUrl/index.js
@@ -56,7 +56,13 @@ router.get('/:name', async (req, res) => {
 
     if (redirectFlag) {
       if (queryString) return res.redirect(`${REAL_HOSTNAME}?${queryString}`)
-      if (hashPath) return res.redirect(`${REAL_HOSTNAME}#${hashPath}/${xtraRoutes.join('/')}`)
+      if (hashPath) {
+        let redirectUrl = `${REAL_HOSTNAME}#${hashPath}`
+        if (xtraRoutes.length > 0) {
+          redirectUrl += `/${xtraRoutes.join('/')}`
+        }
+        return res.redirect(redirectUrl)
+      }
     } else {
       return res.status(200).send(json)
     }
-- 
GitLab