Repository navigation
Conversation
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
Contributor
[Medium impact] The PR appears safe to merge. SummaryFixes downloads when a provider sends a numeric category ID.
Reviews (1) · Last reviewed commit: "fix(downloads): accept a numeric provide..." · Reviewed by Greptile |
Codecov Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2223
Some Xtream providers send a series
category_idas a number (the report has617).createXtreamSeriesDownloadMetadataContextpasses it through asproviderCategoryId, and the shared snapshot builder ran it throughtext(), which calls.trim(). So adding an episode to Downloads threwTypeError: t?.trim is not a function.Fix:
snapshotFieldsnow normalizesproviderCategoryIdwith a smallidentifier()helper. A finite number becomes its string, a string is trimmed as before, and anything else is dropped. The input type is widened tostring | 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 calledString(). 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/utilpasses 382/382. eslint, prettier andtsc(lib + spec) are clean. Change note:.changes/downloads-numeric-category-id.md.