From 346c13e1acdcca59a3fed9d77382807ad3c6a2cc Mon Sep 17 00:00:00 2001 From: Jade Michael Thornton Date: Tue, 17 Aug 2021 09:14:03 -0500 Subject: [PATCH] check parsed name rather than decoded --- lib/core/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/core/index.js b/lib/core/index.js index 35a4136d..02d6e016 100644 --- a/lib/core/index.js +++ b/lib/core/index.js @@ -351,9 +351,8 @@ module.exports = function createMiddleware(_dir, _options) { return; } - // 302 to / if necessary - if (!pathname.match(/\/$/)) { + if (!parsed.pathname.match(/\/$/)) { res.statusCode = 302; const q = parsed.query ? `?${parsed.query}` : ''; res.setHeader('location', `${parsed.pathname}/${q}`);