This is an automated email from the ASF dual-hosted git repository.

tpalfy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/main by this push:
     new 2072e4ed2a NIFI-10105: FetchS3Object decodes Content-Disposition
2072e4ed2a is described below

commit 2072e4ed2a51c927a7eddce9ef0099bc31d1d144
Author: Lehel Boér <[email protected]>
AuthorDate: Wed Jun 8 16:15:42 2022 +0200

    NIFI-10105: FetchS3Object decodes Content-Disposition
    
    This closes #6109.
    
    Signed-off-by: Tamas Palfy <[email protected]>
---
 .../main/java/org/apache/nifi/processors/aws/s3/FetchS3Object.java    | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git 
a/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/FetchS3Object.java
 
b/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/FetchS3Object.java
index db83bad7e9..128657bf31 100644
--- 
a/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/FetchS3Object.java
+++ 
b/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/FetchS3Object.java
@@ -49,6 +49,8 @@ import 
org.apache.nifi.processor.exception.FlowFileAccessException;
 import org.apache.nifi.processor.util.StandardValidators;
 
 import java.io.IOException;
+import java.net.URLDecoder;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -216,7 +218,7 @@ public class FetchS3Object extends AbstractS3Processor {
 
             final ObjectMetadata metadata = s3Object.getObjectMetadata();
             if (metadata.getContentDisposition() != null) {
-                final String contentDisposition = 
metadata.getContentDisposition();
+                final String contentDisposition = 
URLDecoder.decode(metadata.getContentDisposition(), 
StandardCharsets.UTF_8.name());
 
                 if 
(contentDisposition.equals(PutS3Object.CONTENT_DISPOSITION_INLINE) || 
contentDisposition.startsWith("attachment; filename=")) {
                     setFilePathAttributes(attributes, key);

Reply via email to