Web Sources crash: non-string stream fields can trigger `t.trim is not a function`
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 72/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- typescript
- Ambito
- frontend
Direzione di ricerca
Il crash si trova in sourceTitle() in web/components/details/sourcePlaybackPresentation.ts, che chiama .trim() e .split() sui campi del provider senza verificarne il tipo a runtime. Inizia da lì, poi controlla normalizeStream() in web/lib/addons.ts, che passa behaviorHints grezzi. È completato quando sourceTitle() restituisce un valore di fallback invece di lanciare un errore per valori numerici, oggetti o array in behaviorHints.filename e description, con casi di regressione per ciascuno.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Bug
Opening Sources for some titles can crash the whole Details screen on ARVIO Web with:
[details] TypeError: t.trim is not a function. (In 't.trim()', 't.trim' is undefined)
Observed crash report:
- Crash ID:
web-mvxwhr31 - Version:
1793375972320 - Time:
2026-11-01 15:03:42 - Affected title observed: Animals / Zvieratá (2026), IMDb
tt31049299, TMDb1236045
The same account can open Sources for other movies normally. The crash was also reproducible after disabling Stremio stream addons, so this should be treated as a UI hardening issue rather than relying on every provider/source to return perfectly typed data.
Likely cause
web/components/details/sourcePlaybackPresentation.ts currently assumes provider fields are strings:
export function sourceTitle(stream: Pick<StreamSource, "source" | "addonName" | "description" | "behaviorHints">) {
const file = stream.behaviorHints?.filename?.trim();
if (file) return file;
const firstLine = stream.description?.split("\n").map((line) => line.trim()).find(Boolean);
...
}
A runtime payload can still contain behaviorHints.filename or description with a non-string value even though the TS type says string. normalizeStream() also spreads raw behaviorHints through, so a malformed provider value can reach the UI unchanged.
Minimal safe fix
Guard runtime types before calling string methods:
export function sourceTitle(stream: Pick<StreamSource, "source" | "addonName" | "description" | "behaviorHints">) {
const rawFilename = stream.behaviorHints?.filename;
const file = typeof rawFilename === "string" ? rawFilename.trim() : "";
if (file) return file;
const description = typeof stream.description === "string" ? stream.description : "";
const firstLine = description
.split("\n")
.map((line) => line.trim())
.find(Boolean);
if (firstLine && /[._ -]/.test(firstLine) && firstLine.length > 8 && !/^[👤💾⚙️🔗📦]/u.test(firstLine)) {
return firstLine.replace(/\s*💾.*$/u, "").trim() || firstLine;
}
return typeof stream.source === "string" && stream.source
? stream.source
: (typeof stream.addonName === "string" ? stream.addonName : "Source");
}
It would also be worth normalizing raw stream fields in web/lib/addons.ts so bad payloads are contained at the boundary rather than surfacing later in presentation code.
Regression test suggestion
Add cases for sourceTitle() where:
behaviorHints.filenameis a number/object/arraydescriptionis a number/object- both are malformed and fallback to
source/addonName
Expected result: Source Picker renders instead of throwing.
This is especially important because one malformed source should never take down the entire Details screen.
- Lingua principale
- Kotlin
- Stelle
- 760
- Fork
- 122
- Merge medio
- 15h 11m
- PR unite (30g)
- 63
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di ProdigyV21/ARVIO
-
area: web type:feature
Difficoltà 2/5 1-3 ore Idoneità per principianti 63/100
ProdigyV21/ARVIO#444 · 2 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
ProdigyV21/ARVIO#367 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
type:bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 25/100
ProdigyV21/ARVIO#857 ·
I maintainer di solito rispondono entro 1 giorno
-
type:feature
Difficoltà 3/5 1-2 giorni Idoneità per principianti 58/100
ProdigyV21/ARVIO#851 ·
I maintainer di solito rispondono entro 1 giorno
-
[FEATURE]: pcApertatype:feature
Difficoltà 4/5 3-5 giorni Idoneità per principianti 15/100
ProdigyV21/ARVIO#831 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di ProdigyV21/ARVIO
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
NucleusFramework/Nucleus#912 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 71/100
streetcomplete/StreetComplete#7364 · 7 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
Kotlin-server-squad/vizcore#285 ·
I maintainer di solito rispondono entro 1 giorno
-
assertions 🔍
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno