fix: metaDetails redirect when route ends with /

Signed-off-by: Lachezar Lechev <lachezar@ambire.com>
This commit is contained in:
Lachezar Lechev 2025-10-17 12:46:46 +03:00
parent cf73c7942d
commit ea69521912
No known key found for this signature in database
GPG key ID: 69BDCB3ED8CE8037

View file

@ -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]);