Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for single item feeds #23

Merged
merged 1 commit into from
Oct 6, 2020

Conversation

pedromaltez
Copy link
Contributor

Currently this library does not include any items in the items array if the originating RSS feed only has 1 item.

This is due to an inconsistency in the output of xml2json so I guess it could be argued this needs fixing upstream, but the fact remains that the code here relies on channel.item being an Array of Objects, which it is not when the source XML only contains a single item within channel. In this edge case, the content of channel.item is a literal Object by itself.

This leads the if statement on line 85 to fail as objects don't have a length property, and so the entire block is skipped over. Even if the if statement passed, everything within the block still relies on items being an Array.

I think my proposed changes should fix the issue.

Please let me know if you need something from me to be able accept this PR.

@nasa8x nasa8x merged commit 2c1ab04 into nasa8x:master Oct 6, 2020
@pedromaltez pedromaltez deleted the support-single-item-feed branch March 1, 2023 23:11
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.

2 participants