Skip to content

fix(downloads): accept a numeric provider category id (#2223) - #2253

Open
iacsha wants to merge 1 commit into
4gray:masterfrom
iacsha:fix/2223-numeric-category-id
Open

iacsha wants to merge 1 commit into
4gray:masterfrom
iacsha:fix/2223-numeric-category-id

Conversation

@iacsha

@iacsha iacsha commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

Fixes #2223

Some Xtream providers send a series category_id as a number (the report has 617). createXtreamSeriesDownloadMetadataContext passes it through as providerCategoryId, and the shared snapshot builder ran it through text(), which calls .trim(). So adding an episode to Downloads threw TypeError: t?.trim is not a function.

Fix: snapshotFields now normalizes providerCategoryId with a small identifier() helper. A finite number becomes its string, a string is trimmed as before, and anything else is dropped. The input type is widened to string | number. Normalizing at the shared boundary also covers Xtream VOD (movie_data.category_id) and Stalker series, which pass the id through unconverted too. Stalker VOD already called String(). The stored snapshot stays a string, so the electron-backend validator (optionalString) is unchanged.

Tests: a new spec covers numeric ids on the movie and series factories and drops NaN. It fails with the fix neutralized. libs/portal/shared/util passes 382/382. eslint, prettier and tsc (lib + spec) are clean. Change note: .changes/downloads-numeric-category-id.md.

Some Xtream providers send series category_id as a number. The download
snapshot ran it through text(), which calls trim(), so adding an episode
to Downloads threw "t?.trim is not a function". Normalize the category id
to a string (numbers via String, non-finite dropped) at the shared
snapshot boundary, which also covers Xtream VOD and Stalker series.

Fixes 4gray#2223
@greptile-apps

greptile-apps Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Fixes downloads when a provider sends a numeric category ID.

  • Download snapshots keep numeric provider category IDs as text.

Reviews (1) · Last reviewed commit: "fix(downloads): accept a numeric provide..." · Reviewed by Greptile

@codecov

codecov Bot commented Nov 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.88%. Comparing base (cd78a11) to head (7cb17db).
⚠️ Report is 1 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff            @@
##           master    #2253    +/-   ##
========================================
  Coverage   81.88%   81.88%            
========================================
  Files        1905     1905            
  Lines      101633   101637     +4     
  Branches    24852    24094   -758     
========================================
+ Hits        83218    83222     +4     
  Misses      11128    11128            
  Partials     7287     7287            
Flag Coverage Δ
unit 81.88% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows 0.25.0: Xtream episode download fails with numeric providerCategoryId

1 participant