fix: visited state broken for feeds with whitespace in links - #97
Merged
Conversation
Some RSS feeds (e.g. antirez.com) include surrounding whitespace/newlines in <link> tags. FeedSection filters with item.link.trim() but visited keys were stored without trimming, causing a mismatch and visited state never being applied.
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.
Bug
Some RSS feeds (e.g.
https://antirez.com/rss) include surrounding whitespace/newlines in their<link>elements:FeedSectioncorrectly filters usingitem.link.trim(), so visited items are excluded from the new items list. However, when storing the visited key,item.linkwas used without trimming — causing a key mismatch. The stored key was\nhttp://antirez.com/news/158\nbut the lookup key washttp://antirez.com/news/158, so items were never considered visited.Fix
.trim()the link when storing the visited key inonLinkClick,markAllAsVisited, andmarkVisitedInCache— consistent with the existing.trim()in the filter.Test
Added an e2e test in
persistence.spec.tsthat reproduces the bug using a mock feed with whitespace-padded<link>tags.