Minimal Player: Progress % at 0 still shows 35% in the editor, and a value that isn't a number returns 500
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 87/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- typescript
Direzione di ricerca
Leggi in src/templates/podcast/minimal-player.ts le parti relative al campo di avanzamento, al valore predefinito, all’analisi e alla larghezza della barra; confrontane la gestione con parseNumber e il limite in src/templates/blog/series-part.ts. Aggiungi casi mirati in tests/templates/minimal-player.test.ts per zero, valori mancanti o non validi e valori fuori dall’intervallo 0–100. Il lavoro è completato quando anteprima ed esportazione concordano a 0, gli input non validi usano 35, i valori vengono limitati all’intervallo e i controlli richiesti hanno esito positivo.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Open the Minimal Player in the editor (https://og.codercops.com/create/podcast?template=podcast-minimal-player) and drag "Progress %" to 0. The field says 0, but the bar in the preview stays at 35%. The exported image disagrees with the preview: "Copy Image URL" gives a URL with progressPercent=0, and that URL renders an empty bar, which is what you'd expect.
The API also fails on a value that isn't a number: https://og.codercops.com/api/og?template=podcast-minimal-player&progressPercent=abc returns 500 {"error":"Failed to generate image"}, and the server logs Invalid value NaN% for setWidth.
Both come from line 38 of src/templates/podcast/minimal-player.ts:
const progressPercent = Number(params.progressPercent || 35);
The editor passes the number 0, and 0 || 35 is 35. The API passes the string "0", which isn't falsy, so it gets 0 and the bar is empty. "abc" becomes NaN, and Satori throws on the bar's width: 'NaN%' (line 225). Values outside 0 to 100 aren't clamped either: progressPercent=150 only looks right because the track hides the overflow.
What to do
- Parse the value like
parseNumberinsrc/templates/blog/series-part.ts(lines 65 to 70): fall back to 35 only when it's missing, empty or not a finite number, so 0 stays 0. - Clamp the result to 0 to 100, like
series-part.tsdoes for its numbers (lines 72 to 77).
Where to look
src/templates/podcast/minimal-player.ts: the field (line 16), the default (line 27), the parsing (line 38) and the bar width (line 225)src/templates/blog/series-part.ts:parseNumber(lines 65 to 70) and the clamping (lines 72 to 77)tests/templates/: files likeagenda.test.tsandshortcut-tip.test.tstest a single template'srender, so a newminimal-player.test.tscan follow them
Acceptance criteria
- With Progress % at 0, the editor preview shows an empty bar, the same as the exported image
-
progressPercent=abcrenders the default 35% bar instead of returning 500 -
progressPercent=150gives a full bar andprogressPercent=-20an empty one - Tests for 0, the default, a value that isn't a number, and values below 0 and above 100
-
npm run check,npm run testandnpm run buildpass - A screenshot of the editor with Progress % at 0 in the PR
Want to work on this? Comment below and I'll assign it to you. Please take one issue at a time, branch off dev, and open your PR against dev with Closes #164 in the description.
- Lingua principale
- TypeScript
- Stelle
- 8
- Fork
- 4
- Merge medio
- 6h 9m
- PR unite (30g)
- 66
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
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 codercops/ogcops
-
accessibility bug good first issue hacktoberfest ui
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
accessibility bug good first issue hacktoberfest
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
I maintainer di solito rispondono entro 1 giorno
-
bug good first issue hacktoberfest ui
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
bug good first issue hacktoberfest
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
codercops/ogcops#167 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
An empty `imageUrl=`, `logoUrl=` or `template=` returns an error instead of the defaultForse già presa @Saifjafri212213 l’ha presa oggi. Apertabug good first issue hacktoberfest
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
codercops/ogcops#166 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di codercops/ogcops
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
kunchenguid/gh-axi#220 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
prerender: wait for env-runner worker readiness before crawlingForse già presa @sarankumar1325 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno