IQSS / IQSS/dataverse

DataCite exporter double-escapes HTML in description metadata

Open
#12,624 9 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Feature: Metadata Type: Bug
Dominant language
Java
Stars
1.1k
Forks
564
Avg merge
2d 2h
Merged PRs (30d)
29

Description

Problem description
HTML markup in the “Description” field is xml-double-escaped when exported to Datacite.

As a result, HTML content is displayed literal in Datacite Commons and, consequently, in OpenAire as well when OpenAIRE harvests metadata from DataCite.

See https://commons.datacite.org/doi.org/10.7910/dvn/glqwah
In this example descritpion, the linebreaks are rendered as:
... women. <br /><br /> The sample ...

However, a line break is expected.

Here is the cURL request to view the metadata:
curl "https://dataverse.harvard.edu/api/datasets/export?exporter=Datacite&persistentId=doi:10.7910/DVN/GLQWAH"

And here's the response:
... women. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt; ...

But it should be:
... women. &lt;br /&gt;&lt;br /&gt; ...

On the other hand, here's a "working" example from Zenodo that is displayed in DataCite Commons using interpreted HTML, where the text is correctly displayed in bold:
https://commons.datacite.org/doi.org/10.5281/zenodo.6861794

The description in the correspondending downloaded example DataCite XML is not double-escaped:
<description descriptionType="Abstract">&lt;p&gt;&lt;strong&gt;Abstract: &lt;/strong&gt;Feudalism

That's why I suspect that escaping only once would solve the problem. Unfortunately, I can't really test it, so I'm not sure.

Affected versions
at least 6.10 and 6.11 (and probably older versions as well)

Previous Discussion
https://groups.google.com/g/dataverse-community/c/dXqHmgpdJ9k

Any open or closed issues related?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Datacite exporter through the mentioned /api/datasets/export?exporter=Datacite endpoint using the provided persistent ID, then trace how the Description metadata is escaped. Compare the current response with the expected single-escaped form and verify that HTML line breaks remain interpretable without affecting other metadata.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.