mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-05-22 23:06:39 +01:00
fix(seerr): guard SeerrItemRouter query params against undefined
releaseYear and mediaType are typed as required but can be undefined or NaN at runtime, so .toString() could throw inside the onPress handler. Coerce every value with String(... ?? fallback).
This commit is contained in:
@@ -42,7 +42,9 @@ export const TouchableSeerrRouter: React.FC<PropsWithChildren<Props>> = ({
|
||||
onPress={() => {
|
||||
if (!result) return;
|
||||
|
||||
// Build URL with query params - avoids Expo Router's strict type checking
|
||||
// Build URL with query params - avoids Expo Router's strict type checking.
|
||||
// Every value is coerced defensively: releaseYear/mediaType can be
|
||||
// undefined or NaN at runtime, so `.toString()` would throw.
|
||||
const params = new URLSearchParams({
|
||||
...Object.fromEntries(
|
||||
Object.entries(result).map(([key, value]) => [
|
||||
@@ -50,11 +52,11 @@ export const TouchableSeerrRouter: React.FC<PropsWithChildren<Props>> = ({
|
||||
String(value ?? ""),
|
||||
]),
|
||||
),
|
||||
mediaTitle,
|
||||
releaseYear: releaseYear.toString(),
|
||||
canRequest: canRequest.toString(),
|
||||
posterSrc,
|
||||
mediaType: mediaType.toString(),
|
||||
mediaTitle: mediaTitle ?? "",
|
||||
releaseYear: String(releaseYear ?? ""),
|
||||
canRequest: String(canRequest ?? false),
|
||||
posterSrc: posterSrc ?? "",
|
||||
mediaType: String(mediaType ?? ""),
|
||||
});
|
||||
|
||||
router.push(
|
||||
|
||||
Reference in New Issue
Block a user