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.
This commit is contained in:
Biagio Peccerillo 2024-12-17 11:16:29 +01:00
parent c54b64568a
commit a1fad9b9f7
1 changed files with 2 additions and 1 deletions

View File

@ -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);