Minimal Player: Progress % at 0 still shows 35% in the editor, and a value that isn't a number returns 500
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 87/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
Hướng nghiên cứu
Đọc trong src/templates/podcast/minimal-player.ts các phần về trường tiến độ, giá trị mặc định, phân tích và chiều rộng thanh; so sánh cách xử lý với parseNumber và việc giới hạn giá trị trong src/templates/blog/series-part.ts. Thêm các trường hợp kiểm thử tập trung trong tests/templates/minimal-player.test.ts cho giá trị 0, giá trị bị thiếu hoặc không hợp lệ, và giá trị ngoài khoảng 0–100. Hoàn tất khi bản xem trước và bản xuất khớp nhau ở giá trị 0, đầu vào không hợp lệ dùng giá trị 35, các giá trị được giới hạn trong khoảng và các bước kiểm tra được yêu cầu đều đạt.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- TypeScript
- Star
- 8
- Fork
- 4
- Merge trung bình
- 5 giờ 44 phút
- Pull request đã merge (30 ngày)
- 83
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của codercops/ogcops
-
Add the Order Status e-commerce template (`ecommerce-order-status`)Có thể đã có người làm @piyusshhjangid đã nhận hôm nay. Đang mởgood first issue hacktoberfest templates
codercops/ogcops#181 · 4 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add the Cheat Sheet tutorial template (`tutorial-cheat-sheet`)Có thể đã có người làm @srikar-naidu đã nhận hôm nay. Đang mởhacktoberfest help wanted templates
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 45/100
codercops/ogcops#180 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add the Call for Speakers event template (`event-call-for-speakers`)Có thể đã có người làm @Saifjafri212213 đã nhận hôm nay. Đang mởgood first issue hacktoberfest templates
codercops/ogcops#177 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add the Day Streak developer template (`developer-day-streak`)Có thể đã có người làm @srikar-naidu đã nhận hôm nay. Đang mởhacktoberfest help wanted templates
codercops/ogcops#176 · 3 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Hacktoberfest 2026: start hereĐang mởhacktoberfest
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của codercops/ogcops
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
db-ux-design-system/core-web#8613 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug:new
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
callstackincubator/simlock#934 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Log page not working after errorĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
gchq/LD-Explorer#286 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
foxglove/mcap#1907 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày