diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/controller/ControllerFacade.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/controller/ControllerFacade.java index 47ebd3039e..dbf24e1c08 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/controller/ControllerFacade.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/controller/ControllerFacade.java @@ -820,7 +820,12 @@ public class ControllerFacade { } // get the flowfile attributes - final Map attributes = event.getAttributes(); + final Map attributes; + if (ContentDirection.INPUT.equals(contentDirection)) { + attributes = event.getPreviousAttributes(); + } else { + attributes = event.getAttributes(); + } // calculate the dn chain final List dnChain = ProxiedEntitiesUtils.buildProxiedEntitiesChain(user); @@ -831,14 +836,14 @@ public class ControllerFacade { throw new AccessDeniedException(downloadAuthorization.getExplanation()); } - // get the filename and fall back to the idnetifier (should never happen) - String filename = event.getAttributes().get(CoreAttributes.FILENAME.key()); + // get the filename and fall back to the identifier (should never happen) + String filename = attributes.get(CoreAttributes.FILENAME.key()); if (filename == null) { filename = event.getFlowFileUuid(); } // get the mime-type - final String type = event.getAttributes().get(CoreAttributes.MIME_TYPE.key()); + final String type = attributes.get(CoreAttributes.MIME_TYPE.key()); // get the content final InputStream content = flowController.getContent(event, contentDirection, user.getIdentity(), uri);