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

Escape description for use in datacite xml (file and datacite api call) #7798

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/
package edu.harvard.iq.dataverse;

import edu.harvard.iq.dataverse.AbstractGlobalIdServiceBean.GlobalIdMetadataTemplate;
import edu.harvard.iq.dataverse.branding.BrandingUtil;

import java.io.ByteArrayOutputStream;
Expand All @@ -21,7 +20,6 @@
import java.util.logging.Logger;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.TypedQuery;
Expand Down Expand Up @@ -176,7 +174,8 @@ public static String getMetadataFromDvObject(String identifier, Map<String, Stri
metadataTemplate.setCreators(Util.getListFromStr(metadata.get("datacite.creator")));
metadataTemplate.setAuthors(dataset.getLatestVersion().getDatasetAuthors());
if (dvObject.isInstanceofDataset()) {
String description = dataset.getLatestVersion().getDescriptionPlainText();
//While getDescriptionPlainText strips < and > from HTML, it leaves '&' (at least so we need to xml escape as well
String description = StringEscapeUtils.escapeXml(dataset.getLatestVersion().getDescriptionPlainText());
if (description.isEmpty() || description.equals(DatasetField.NA_VALUE)) {
description = AbstractGlobalIdServiceBean.UNAVAILABLE;
}
Expand Down