Skip to content

Conversation

@neizod
Copy link
Contributor

@neizod neizod commented Jan 28, 2022

My friend's site using XML feed and only have one entry. When I try to fetch the feed it returns

Trace: TypeError: item.map is not a function
    at parseRSS (file:///home/neizod/feed-reader/src/utils/parser.js:88:24)
    at read (file:///home/neizod/feed-reader/src/main.js:34:27)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async extractFromUrl (file:///home/neizod/feed-reader/eval.js:10:17)
    at extractFromUrl (file:///home/neizod/feed-reader/eval.js:14:13)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)

As I investigate, the item variable, after parsed from XML into JSON, can be an array or an object (like the case of Atom in the same file). Thus, .map function fail to work on when it is actually an object.

This PR should fix the issue.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@neizod neizod changed the title Fix XML paring for sites with only one entry Fix XML parsing for sites with only one entry Jan 28, 2022
@coveralls
Copy link

Coverage Status

Coverage remained the same at 95.122% when pulling f64f48a on neizod:main into 5c4bfc2 on ndaidong:main.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 95.122% when pulling f64f48a on neizod:main into 5c4bfc2 on ndaidong:main.

@ndaidong
Copy link
Collaborator

@neizod thank you for your fix. I will merge this pr now.

@ndaidong ndaidong merged commit 6778f2d into extractus:main Jan 29, 2022
ndaidong added a commit that referenced this pull request Jan 29, 2022
- Merge pr #30 by @neizod
- Fix wrong function name from pr #30
- Add more tests for pr #30
- Update dependencies
@ndaidong ndaidong mentioned this pull request Jan 29, 2022
ndaidong added a commit that referenced this pull request Apr 8, 2022
- Change to ES6 Module format
- Update dependencies
- Fix some stuff

Thanks to @neizod for pr #30 :)
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.

3 participants