diff --git a/js/app.js b/js/app.js index 9196a325..65a4f1ed 100644 --- a/js/app.js +++ b/js/app.js @@ -716,7 +716,7 @@ class bitvidApp { return decodeURIComponent(value); } catch (err) { console.warn("Failed to decode data attribute:", err); - return ""; + return value; } }; @@ -724,7 +724,8 @@ class bitvidApp { const encodedMagnet = trigger.getAttribute("data-play-magnet") || ""; const url = decodeDataValue(encodedUrl); - const magnet = decodeDataValue(encodedMagnet); + const rawMagnet = decodeDataValue(encodedMagnet); + const magnet = safeDecodeMagnet(rawMagnet) || rawMagnet; const eventId = trigger.getAttribute("data-video-id"); if (eventId) { diff --git a/js/channelProfile.js b/js/channelProfile.js index 02d61019..e8bc1ecd 100644 --- a/js/channelProfile.js +++ b/js/channelProfile.js @@ -490,7 +490,15 @@ function localConvertEventToVideo(event) { const trimmedMagnet = typeof magnet === "string" ? magnet.trim() : ""; const trimmedInfoHash = typeof infoHash === "string" ? infoHash.trim() : ""; const playbackMagnet = trimmedMagnet || trimmedInfoHash; - const numericVersion = Number.isFinite(version) ? version : 0; + const parsedVersion = + typeof version === "number" + ? version + : typeof version === "string" + ? Number.parseInt(version, 10) + : Number.NaN; + const numericVersion = Number.isFinite(parsedVersion) + ? parsedVersion + : 0; const hasPlayableSource = Boolean(trimmedUrl) || Boolean(playbackMagnet); if (!hasPlayableSource) { diff --git a/js/subscriptions.js b/js/subscriptions.js index b49e7bf8..20f85344 100644 --- a/js/subscriptions.js +++ b/js/subscriptions.js @@ -518,7 +518,15 @@ class SubscriptionsManager { const trimmedMagnet = typeof magnet === "string" ? magnet.trim() : ""; const trimmedInfoHash = typeof infoHash === "string" ? infoHash.trim() : ""; const playbackMagnet = trimmedMagnet || trimmedInfoHash; - const numericVersion = Number.isFinite(version) ? version : 0; + const parsedVersion = + typeof version === "number" + ? version + : typeof version === "string" + ? Number.parseInt(version, 10) + : Number.NaN; + const numericVersion = Number.isFinite(parsedVersion) + ? parsedVersion + : 0; const hasPlayableSource = Boolean(trimmedUrl) || Boolean(playbackMagnet); if (!hasPlayableSource) {