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

Malformed anchor hrefs can cause an app crash #430

Closed
Jaifroid opened this issue Oct 17, 2018 · 3 comments
Closed

Malformed anchor hrefs can cause an app crash #430

Jaifroid opened this issue Oct 17, 2018 · 3 comments
Assignees
Labels
Milestone

Comments

@Jaifroid
Copy link
Member

As reported in this comment (but note the article was "Cancer Immunotherapy" in the September 2018 WikiMed, and it has been corrected in later versions), a malformed anchor href causes the app to crash, at least in Edge. The problem was a malformed DOI: reference. Although transient, as a Wikipedia bot no doubt corrected it, our app should be a bit more tolerant of the possibility that this.href, this.protocol and this.host could be undefined. The crash occurs here, and when that is corrected, it occurs here.

A workaround is to use jQuery for those specific this references, as elsewhere in this function. However, we could also or instead add a test, like if (!this.href) return;

@Jaifroid Jaifroid added the bug label Oct 17, 2018
@Jaifroid Jaifroid self-assigned this Oct 17, 2018
@mossroy
Copy link
Contributor

mossroy commented Oct 20, 2018

I vote to fix this issue, as the fix you proposed was generic.
If the if(!this.href) test is enough, it might be a less risky modification of the code, except if you see other benefits from switching to jQuery here?

@Jaifroid
Copy link
Member Author

I've created https://github.com/kiwix/kiwix-js/tree/Prevent-app-crash-with-malformed-anchor-hrefs to test the issue. It's got the jQuery fix added to it so I don't forget that fix, but I'll look into the simpler fix.

@mossroy mossroy added this to the v2.5 milestone Oct 21, 2018
@Jaifroid
Copy link
Member Author

Just for info, I've re-downloaded the September WikiMed (which I had accidentally deleted), and the problematic article is indeed Immunotherapy, as I had originally stated. It "reliably" causes an app crash on master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants