diff --git a/src/main/java/edu/harvard/iq/dataverse/FileDownloadServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/FileDownloadServiceBean.java
index 65e6b259bf4..aa37c579224 100644
--- a/src/main/java/edu/harvard/iq/dataverse/FileDownloadServiceBean.java
+++ b/src/main/java/edu/harvard/iq/dataverse/FileDownloadServiceBean.java
@@ -462,7 +462,7 @@ public void downloadCitationBibtex(FileMetadata fileMetadata, Dataset dataset, b
HttpServletResponse response = (HttpServletResponse) ctx.getExternalContext().getResponse();
//Fix for 6029 FireFox was failing to parse it when content type was set to json
- response.setContentType("text/plain");
+ response.setContentType("text/plain;charset=utf-8");
String fileNameString;
if (fileMetadata == null || fileMetadata.getLabel() == null) {
diff --git a/src/main/java/edu/harvard/iq/dataverse/api/dto/DatasetVersionDTO.java b/src/main/java/edu/harvard/iq/dataverse/api/dto/DatasetVersionDTO.java
index 37fe197280b..84a76e9017b 100644
--- a/src/main/java/edu/harvard/iq/dataverse/api/dto/DatasetVersionDTO.java
+++ b/src/main/java/edu/harvard/iq/dataverse/api/dto/DatasetVersionDTO.java
@@ -56,6 +56,9 @@ public void setInReview(boolean inReview) {
}
public String getTermsOfUse() {
+ if (termsOfUse != null && termsOfUse.contains("CC0")) {
+ termsOfUse = termsOfUse.replace("CC0", "CC BY");
+ }
return termsOfUse;
}
diff --git a/src/main/java/edu/harvard/iq/dataverse/export/openaire/OpenAireExportUtil.java b/src/main/java/edu/harvard/iq/dataverse/export/openaire/OpenAireExportUtil.java
index 49fe203b96d..9e688c146f4 100644
--- a/src/main/java/edu/harvard/iq/dataverse/export/openaire/OpenAireExportUtil.java
+++ b/src/main/java/edu/harvard/iq/dataverse/export/openaire/OpenAireExportUtil.java
@@ -1132,6 +1132,7 @@ public static void writeAccessRightsElement(XMLStreamWriter xmlw, DatasetVersion
xmlw.writeEndElement(); //
writeRightsHeader(xmlw, language);
+
if (datasetVersionDTO.getLicense() != null) {
xmlw.writeAttribute("rightsURI", datasetVersionDTO.getLicense().getUri());
xmlw.writeCharacters(datasetVersionDTO.getLicense().getName());
diff --git a/src/main/java/edu/harvard/iq/dataverse/util/FileUtil.java b/src/main/java/edu/harvard/iq/dataverse/util/FileUtil.java
index 339de904f9e..aaccd717840 100644
--- a/src/main/java/edu/harvard/iq/dataverse/util/FileUtil.java
+++ b/src/main/java/edu/harvard/iq/dataverse/util/FileUtil.java
@@ -207,6 +207,8 @@ public class FileUtil implements java.io.Serializable {
private static final String FILE_FACET_CLASS_TEXT = "Text";
private static final String FILE_FACET_CLASS_OTHER = "Other";
private static final String FILE_FACET_CLASS_UNKNOWN = "Unknown";
+
+ public static final String OVERWRITE_MIME_TYPE_PREFIX = "force-";
// The file type facets and type-specific thumbnail classes (above) are
// very similar, but not exactly 1:1; so the following map is for
@@ -819,24 +821,32 @@ public static CreateDataFileResult createDataFiles(DatasetVersion version, Input
// than the type supplied:
// -- L.A.
String recognizedType = null;
-
- try {
- recognizedType = determineFileType(tempFile.toFile(), fileName);
- logger.fine("File utility recognized the file as " + recognizedType);
- if (recognizedType != null && !recognizedType.equals("")) {
- if (useRecognizedType(suppliedContentType, recognizedType)) {
- finalType = recognizedType;
- }
- }
-
- } catch (Exception ex) {
- logger.warning("Failed to run the file utility mime type check on file " + fileName);
+
+ // If we detect the dataverse prefix in the supplied mimetype we do no
+ // further recognition
+ if (suppliedContentType.toLowerCase().startsWith(OVERWRITE_MIME_TYPE_PREFIX)) {
+ finalType = suppliedContentType.toLowerCase().substring(OVERWRITE_MIME_TYPE_PREFIX.length());
+ logger.fine("Overwrite prefix detected. Using supplied mime type.");
}
-
- if (finalType == null) {
- finalType = (suppliedContentType == null || suppliedContentType.equals(""))
- ? MIME_TYPE_UNDETERMINED_DEFAULT
- : suppliedContentType;
+ else {
+ try {
+ recognizedType = determineFileType(tempFile.toFile(), fileName);
+ logger.fine("File utility recognized the file as " + recognizedType);
+ if (recognizedType != null && !recognizedType.equals("")) {
+ if (useRecognizedType(suppliedContentType, recognizedType)) {
+ finalType = recognizedType;
+ }
+ }
+
+ } catch (Exception ex) {
+ logger.warning("Failed to run the file utility mime type check on file " + fileName);
+ }
+
+ if (finalType == null) {
+ finalType = (suppliedContentType == null || suppliedContentType.equals(""))
+ ? MIME_TYPE_UNDETERMINED_DEFAULT
+ : suppliedContentType;
+ }
}
// A few special cases:
diff --git a/src/main/java/edu/harvard/iq/dataverse/util/MarkupChecker.java b/src/main/java/edu/harvard/iq/dataverse/util/MarkupChecker.java
index ef74819f073..141cce50cbd 100644
--- a/src/main/java/edu/harvard/iq/dataverse/util/MarkupChecker.java
+++ b/src/main/java/edu/harvard/iq/dataverse/util/MarkupChecker.java
@@ -33,8 +33,8 @@ public static String sanitizeBasicHTML(String unsafe) {
// basic includes: a, b, blockquote, br, cite, code, dd, dl, dt, em, i, li, ol, p, pre, q, small, span, strike, strong, sub, sup, u, ul
//Whitelist wl = Whitelist.basic().addTags("img", "h1", "h2", "h3", "kbd", "hr", "s", "del");
- Safelist sl = Safelist.basicWithImages().addTags("h1", "h2", "h3", "kbd", "hr", "s", "del", "map", "area").addAttributes("img", "usemap")
- .addAttributes("map", "name").addAttributes("area", "shape", "coords", "href", "title", "alt")
+ Safelist sl = Safelist.basicWithImages().addTags("h1", "h2", "h3", "kbd", "hr", "s", "del", "map", "area").addAttributes("img", "usemap", "style")
+ .addAttributes("map", "name").addAttributes("area", "shape", "coords", "href", "title", "alt").addAttributes("ol", "type")
.addEnforcedAttribute("a", "target", "_blank");
return Jsoup.clean(unsafe, sl);
diff --git a/src/main/java/edu/harvard/iq/dataverse/util/json/JsonParser.java b/src/main/java/edu/harvard/iq/dataverse/util/json/JsonParser.java
index 4ecdc73ae6e..98cea105366 100644
--- a/src/main/java/edu/harvard/iq/dataverse/util/json/JsonParser.java
+++ b/src/main/java/edu/harvard/iq/dataverse/util/json/JsonParser.java
@@ -407,7 +407,7 @@ public DatasetVersion parseDatasetVersion(JsonObject obj, DatasetVersion dsv) th
throw new JsonParseException(BundleUtil.getStringFromBundle("jsonparser.error.parsing.number", Arrays.asList(ex.getMessage())), ex);
}
}
-
+
private edu.harvard.iq.dataverse.license.License parseLicense(String licenseNameOrUri) throws JsonParseException {
if (licenseNameOrUri == null){
boolean safeDefaultIfKeyNotFound = true;
diff --git a/src/main/java/edu/harvard/iq/dataverse/util/json/JsonPrinter.java b/src/main/java/edu/harvard/iq/dataverse/util/json/JsonPrinter.java
index e088122419d..4f1dfd54fcd 100644
--- a/src/main/java/edu/harvard/iq/dataverse/util/json/JsonPrinter.java
+++ b/src/main/java/edu/harvard/iq/dataverse/util/json/JsonPrinter.java
@@ -420,6 +420,18 @@ public static JsonObjectBuilder jsonDataFileList(List
+