fix(opml): correct import progress math and saved-count reporting - #221
Merged
Merged
Conversation
When every feed in an imported OPML is already subscribed, newPodcastsToAdd.length is 0, so updateProgress computed (0 / 0) * 100 = NaN and flashed "Importing... 0/0 podcasts completed (NaN%)". Guard the zero denominator and show "No new podcasts to import." instead. The save loop keys feeds by title and skips collisions, but the completion message reported validPodcasts.length (the number fetched), over-reporting "saved" when two imported feeds share a title or an imported feed's title matches an existing saved feed. Count the feeds actually written and report dropped duplicate-title collisions separately so the summary reflects what was stored. Resolves deepsec finding other-logic-bug (922f3003f7).
Deploying podnotes with
|
| Latest commit: |
c274acc
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://f23184be.podnotes.pages.dev |
| Branch Preview URL: | https://chhoumann-deepsec-opml-progr.podnotes.pages.dev |
github-actions Bot
pushed a commit
that referenced
this pull request
Jul 9, 2026
## [2.17.3](2.17.2...2.17.3) (2026-07-09) ### Bug Fixes * **feed/search:** parse feed once + content-based search cache ([#225](#225)) ([053d51f](053d51f)), closes [#149](#149) * make episode identity key collision-resistant and prototype-safe ([#226](#226)) ([a5683db](a5683db)) * **opml:** correct import progress math and saved-count reporting ([#221](#221)) ([a79e529](a79e529)) * **security:** validate feed/URI URLs and cap download size ([#223](#223)) ([edef281](edef281)) * **template:** neutralize feed-controlled note injection ([#228](#228)) ([ef4ecbd](ef4ecbd)) * **timestamp:** escape live table-cell pipe after an escaped backslash ([#227](#227)) ([a34dfca](a34dfca)) * **transcription:** resolve three deepsec transcription-pipeline bugs ([#224](#224)) ([83c34e7](83c34e7))
Contributor
|
🎉 This PR is included in version 2.17.3 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
Summary
Fixes two correctness bugs in OPML import (
src/opml.ts), flagged by the deepsec findingother-logic-bug(922f3003f7).1. Progress notice showed
NaN%When every feed in the imported OPML is already subscribed,
newPodcastsToAdd.lengthis0, soupdateProgresscomputed(0 / 0) * 100 = NaNand(NaN).toFixed(1)rendered the string"NaN".Promise.all([])resolves immediately, so the loop never re-ran progress and the user sawImporting... 0/0 podcasts completed (NaN%).Fix: guard the zero denominator and show
No new podcasts to import.instead.2. Completion message over-reported the saved count
savedFeedsis keyed by title, and the save loop skips collisions (if (feeds[pod.title]) continue;). But the completion message reportedvalidPodcasts.length(feeds fetched), so two imported feeds sharing a<title>(distinct URLs), or a new-URL feed whose title matches an existing saved feed, were silently dropped yet still counted as "saved".Fix: count the feeds actually written (
savedCount) and report duplicate-title drops on their own counter, so the summary reflects what was stored:Tests
src/opml.test.tsnow captures the strings rendered into the progress Notice and asserts:NaNis ever shown when every feed is already subscribedAll four new tests fail against the old code.
Gates
lint,typecheck,build, and the fulltestsuite (772+ tests) pass. Scoped tosrc/opml.tsandsrc/opml.test.tsonly.