From 9cef111272f31866cd239868c0000e5bc926cc8d Mon Sep 17 00:00:00 2001 From: fintanorbert Date: Fri, 1 Mar 2024 12:19:07 +0100 Subject: [PATCH] Encode Dataset id-s --- .../java/edu/harvard/iq/dataverse/api/arp/RoCrateManager.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/edu/harvard/iq/dataverse/api/arp/RoCrateManager.java b/src/main/java/edu/harvard/iq/dataverse/api/arp/RoCrateManager.java index 74d8245173e..f4ce6bb8b38 100644 --- a/src/main/java/edu/harvard/iq/dataverse/api/arp/RoCrateManager.java +++ b/src/main/java/edu/harvard/iq/dataverse/api/arp/RoCrateManager.java @@ -34,6 +34,8 @@ import java.io.File; import java.io.FileWriter; import java.io.IOException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -2284,7 +2286,7 @@ private String createRoIdForDataset(String folderName, JsonNode parentObj) { if (parentId.equals("./")) { parentId = ""; } - return parentId + folderName + "/"; + return parentId + URLEncoder.encode(folderName.replaceAll("\\s", "_"), StandardCharsets.UTF_8) + "/"; } // At this point this function would be useless