Minimal Player: Progress % at 0 still shows 35% in the editor, and a value that isn't a number returns 500
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 87/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript
調査の方向性
src/templates/podcast/minimal-player.tsで、進捗フィールド、デフォルト値、解析、バーの幅に関する箇所を読み、parseNumberおよびsrc/templates/blog/series-part.tsでの制限処理と比較してください。tests/templates/minimal-player.test.tsに、ゼロ、値がない場合や無効な値、0~100の範囲外の値について、的を絞ったケースを追加してください。プレビューとエクスポートが0で一致し、無効な入力には35が使われ、値が範囲内に制限され、指定されたチェックに合格すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- TypeScript
- スター
- 8
- フォーク
- 4
- 平均マージ
- 6時間 9分
- マージ済み PR(30日)
- 66
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
codercops/ogcops のほかの issue
-
accessibility bug good first issue hacktoberfest ui
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
accessibility bug good first issue hacktoberfest
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
メンテナーはふだん 1 日以内に返信
-
bug good first issue hacktoberfest ui
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
bug good first issue hacktoberfest
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
codercops/ogcops#167 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
An empty `imageUrl=`, `logoUrl=` or `template=` returns an error instead of the default対応中かも @Saifjafri212213 が今日担当しました。 オープンbug good first issue hacktoberfest
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
codercops/ogcops#166 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
codercops/ogcops の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
phivk/rubiks-lab#33 ·
メンテナーはふだん 1 日以内に返信
-
BUG:Edit Album strips spaces from the password so albums with a leading/trailing space in the password can't be edited対応中かも @ManyaJain111 が今日担当しました。 オープンbug enhancement possible-duplicate
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
AOSSIE-Org/PictoPy#1637 · コメント 4 件 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
chaitin/MonkeyCode#1437 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
area:cards enhancement migration ready-for-agent
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
fil-donadoni/tolaria#6309 ·
メンテナーはふだん 1 日以内に返信