elifesciences / elife-crossref-xml-generation

Crossref deposit of journal articles
MIT License
4 stars 3 forks source link

Fix for an edge case where angle brackets were not escaped properly. #56

Closed gnott closed 6 years ago

gnott commented 6 years ago

I noticed elife-28716-v2.xml has remained in the Crossref outbox since Nov 17th, and it was not approved for Crossref delivery. I downloaded it to test locally, and it had an issue with a subtitle having an unmatched angle bracket.

The situation presented itself in a figure caption had

<<italic>p</italic>>

Adding this to a Crossref component subtitle, it strips out known tags first. italic is a known tag so after stripping it ended up with

<p>

Shortly after it escapes unmatched angle brackets, but <p> is on the list of allowed tags that were passed in. In this situation, no allowed tags should have been passed in (since all the allowed tags were already stripped out, all the remaining angle brackets should be escaped).

We want the output in the Crossref deposit escaped as

&lt;p&gt;

This change should fix it and there's a test to support it.

For @giorgiosironi beyond reviewing the code, if you would like to, this merged version of elifecrossref should get updated in the elife-bot project and deployed. I can prepare that PR too for review after this is merged.

coveralls commented 6 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling ced5fde07e3f25828367fd8422cc67cf0fd6ac34 on feature-bugfix-add_clean_tag into 062e12f8d29fa00efaf8ffb2fbdcf7a495bd9f5e on develop.