Vitaliy-1 / JATSParserPlugin

OJS3 Plugin for parsing JATS XML and displaying it on article detail page
GNU General Public License v3.0
27 stars 24 forks source link

Ensure image URL is properly encoded #40

Closed Vitaliy-1 closed 3 years ago

Vitaliy-1 commented 3 years ago

Related to: https://forum.pkp.sfu.ca/t/jatsparserplugin-and-oldgregg-after-upgrade-to-3-2-1-2/64498/11

The Texture plugin doesn't escape spaces in the URI of the image in the JATS XML output. To reproduce:

  1. Create new JATS XML file
  2. Open with Texture
  3. Create a new Figure, upload a file with a filename that contains spaces, e.g. fig 1.jpg as per forum thread.
  4. Save the file and explore tags related to a new figure:
    <graphic id="graphic-2b9ee4ad70b4c56ec056012bf94bd7fa" mimetype="image" mime-subtype="jpeg" xlink:href="fig 1.jpg"/>

    according to the JATS XML specification: https://jats.nlm.nih.gov/publishing/tag-library/1.3d1/attribute/xlink-href.html

As specified in XML Linking Language (XLink) Version 1.0, the value of an @xlink:href must be a valid URI.

if considering encoded one: xlink:href="fig%201.jpg