From a1fad9b9f7b223121f18da198d1a3e1359142233 Mon Sep 17 00:00:00 2001 From: "biagio.peccerillo" Date: Tue, 17 Dec 2024 11:16:29 +0100 Subject: [PATCH] Solved Incident #28539 Amazon S3 backend have some problem processing non-ASCII characters. This behavious arised when uploading files with such characters in their filename from the workspace, because filename is used as the meta-tag "title" on the S3 backend. The solution required to URL-encode title before passing it to the backend. --- .../data/access/storagehub/storage/backend/impl/S3Backend.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/gcube/data/access/storagehub/storage/backend/impl/S3Backend.java b/src/main/java/org/gcube/data/access/storagehub/storage/backend/impl/S3Backend.java index 6220f25..56e3c1e 100644 --- a/src/main/java/org/gcube/data/access/storagehub/storage/backend/impl/S3Backend.java +++ b/src/main/java/org/gcube/data/access/storagehub/storage/backend/impl/S3Backend.java @@ -1,6 +1,7 @@ package org.gcube.data.access.storagehub.storage.backend.impl; import java.io.InputStream; +import java.net.URLEncoder; import java.util.HashMap; import java.util.Map; import java.util.function.Function; @@ -139,7 +140,7 @@ public class S3Backend extends StorageBackend{ ObjectMetadata objMeta = new ObjectMetadata(); objMeta.addUserMetadata("user", user); - objMeta.addUserMetadata("title", name); + objMeta.addUserMetadata("title", URLEncoder.encode(name, "UTF-8")); if (size != null && size >0) { objMeta.setContentLength(size);