From e12f498afa6d9f817e9ccc3267fccb1da19cf8db Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Sun, 13 Jul 2025 18:50:14 -0400 Subject: [PATCH] avoid redirect when served directly from versioned url --- app.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app.js b/app.js index cfa02a21..b0aa84c5 100644 --- a/app.js +++ b/app.js @@ -341,12 +341,11 @@ const redirList = [ function handleVersion(req, res, next) { let vstr = oversion || dversion || version; - if (!redirList.indexOf(req.app.path) >= 0 && req.url.indexOf(vstr) < 0) { - let pp = req.app.ispre ? pre : undefined; + if (!req.app.ispre && !redirList.indexOf(req.app.path) >= 0 && req.url.indexOf(vstr) < 0) { if (req.url.indexOf("?") > 0) { - return http.redirect(res, `${pp??''}${req.url},ver:${vstr}`); + return http.redirect(res, `${req.url},ver:${vstr}`); } else { - return http.redirect(res, `${pp??''}${req.url}?ver:${vstr}`); + return http.redirect(res, `${req.url}?ver:${vstr}`); } } else if (!debug) { // in production serve packed bundles