From ea69521912fa8d7f51c0460ad40937aa82e61cc1 Mon Sep 17 00:00:00 2001 From: Lachezar Lechev Date: Fri, 17 Oct 2025 12:46:46 +0300 Subject: [PATCH] fix: metaDetails redirect when route ends with / Signed-off-by: Lachezar Lechev --- src/routes/MetaDetails/MetaDetails.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/routes/MetaDetails/MetaDetails.js b/src/routes/MetaDetails/MetaDetails.js index d806ffed5..7d6f21d69 100644 --- a/src/routes/MetaDetails/MetaDetails.js +++ b/src/routes/MetaDetails/MetaDetails.js @@ -81,7 +81,11 @@ const MetaDetails = ({ urlParams, queryParams }) => { const handleEpisodeSearch = React.useCallback((season, episode) => { const searchVideoHash = encodeURIComponent(`${urlParams.id}:${season}:${episode}`); const url = window.location.hash; - const searchVideoPath = url.replace(encodeURIComponent(urlParams.videoId), searchVideoHash); + + const searchVideoPath = (urlParams.videoId === undefined || urlParams.videoId === null || urlParams.videoId === '') ? + url + (!url.endsWith('/') ? '/' : '') + searchVideoHash + : url.replace(encodeURIComponent(urlParams.videoId), searchVideoHash); + window.location = searchVideoPath; }, [urlParams, window.location]);