From a335b09d4048d84d182fe94fd50cb9651ebbb8dd Mon Sep 17 00:00:00 2001 From: Vladimir Kharlampidi Date: Mon, 6 Feb 2023 11:18:00 +0300 Subject: [PATCH] feat(history): allow empty string `key` fixes #6338 --- src/modules/history/history.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/history/history.js b/src/modules/history/history.js index 9de61ddd8..aa292b892 100644 --- a/src/modules/history/history.js +++ b/src/modules/history/history.js @@ -56,9 +56,9 @@ export default function History({ swiper, extendParams, on }) { if (swiper.params.history.root.length > 0) { let root = swiper.params.history.root; if (root[root.length - 1] === '/') root = root.slice(0, root.length - 1); - value = `${root}/${key}/${value}`; + value = `${root}/${key ? `${key}/` : ''}${value}`; } else if (!location.pathname.includes(key)) { - value = `${key}/${value}`; + value = `${key ? `${key}/` : ''}${value}`; } if (swiper.params.history.keepQuery) { value += location.search;