kent-nguyen commented on a change in pull request #4423:
URL: https://github.com/apache/nifi/pull/4423#discussion_r464188817



##########
File path: 
nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/FetchS3Object.java
##########
@@ -165,14 +165,19 @@ public void onTrigger(final ProcessContext context, final 
ProcessSession session
 
             final ObjectMetadata metadata = s3Object.getObjectMetadata();
             if (metadata.getContentDisposition() != null) {
-                final String fullyQualified = metadata.getContentDisposition();
-                final int lastSlash = fullyQualified.lastIndexOf("/");
-                if (lastSlash > -1 && lastSlash < fullyQualified.length() - 1) 
{
-                    attributes.put(CoreAttributes.PATH.key(), 
fullyQualified.substring(0, lastSlash));
-                    attributes.put(CoreAttributes.ABSOLUTE_PATH.key(), 
fullyQualified);
-                    attributes.put(CoreAttributes.FILENAME.key(), 
fullyQualified.substring(lastSlash + 1));
+                final String contentDisposition = 
metadata.getContentDisposition();
+
+                if 
(contentDisposition.equals(PutS3Object.CONTENT_DISPOSITION_INLINE) || 
contentDisposition.startsWith("attachment; filename=")) {
+                    attributes.put(CoreAttributes.FILENAME.key(), key);

Review comment:
       @turcsanyip Thanks for your explanation, it is clear and helps me a lot. 
I have updated the unit test and attribute setting code in FetchS3Object 
processor.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to