You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ex...@apache.org on 2023/04/26 21:39:01 UTC
[nifi] branch main updated: NIFI-8971 Removed legacy FlowFile name and path attributes
This is an automated email from the ASF dual-hosted git repository.
exceptionfactory 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 afdbed5749 NIFI-8971 Removed legacy FlowFile name and path attributes
afdbed5749 is described below
commit afdbed57498b92b7dee9d913973cf07086c3c746
Author: Aakash Chauhan <aa...@gmail.com>
AuthorDate: Fri Apr 29 02:13:45 2022 +0530
NIFI-8971 Removed legacy FlowFile name and path attributes
This closes #6003
Signed-off-by: David Handermann <ex...@apache.org>
---
.../org/apache/nifi/processors/standard/MergeContent.java | 7 -------
.../org/apache/nifi/processors/standard/UnpackContent.java | 6 ------
.../nifi/processors/standard/servlets/ListenHTTPServlet.java | 11 -----------
3 files changed, 24 deletions(-)
diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/MergeContent.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/MergeContent.java
index 9dc33c3698..9efe540163 100644
--- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/MergeContent.java
+++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/MergeContent.java
@@ -886,13 +886,6 @@ public class MergeContent extends BinFiles {
public void process(final InputStream rawIn) throws IOException {
try (final InputStream in = new BufferedInputStream(rawIn)) {
final Map<String, String> attributes = new HashMap<>(flowFile.getAttributes());
-
- // for backward compatibility purposes, we add the "legacy" NiFi attributes
- attributes.put("nf.file.name", attributes.get(CoreAttributes.FILENAME.key()));
- attributes.put("nf.file.path", attributes.get(CoreAttributes.PATH.key()));
- if (attributes.containsKey(CoreAttributes.MIME_TYPE.key())) {
- attributes.put("content-type", attributes.get(CoreAttributes.MIME_TYPE.key()));
- }
packager.packageFlowFile(in, out, attributes, flowFile.getSize());
}
}
diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/UnpackContent.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/UnpackContent.java
index 1c7629cb97..697b84ccd6 100644
--- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/UnpackContent.java
+++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/UnpackContent.java
@@ -547,12 +547,6 @@ public class UnpackContent extends AbstractProcessor {
// and later unpack it -- in this case, we have two FlowFiles with the same UUID.
attributes.remove(CoreAttributes.UUID.key());
- // maintain backward compatibility with legacy NiFi attribute names
- mapAttributes(attributes, "nf.file.name", CoreAttributes.FILENAME.key());
- mapAttributes(attributes, "nf.file.path", CoreAttributes.PATH.key());
- mapAttributes(attributes, "content-encoding", CoreAttributes.MIME_TYPE.key());
- mapAttributes(attributes, "content-type", CoreAttributes.MIME_TYPE.key());
-
if (!attributes.containsKey(CoreAttributes.MIME_TYPE.key())) {
attributes.put(CoreAttributes.MIME_TYPE.key(), OCTET_STREAM);
}
diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/servlets/ListenHTTPServlet.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/servlets/ListenHTTPServlet.java
index 2793e1be12..73f0d9b1ad 100644
--- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/servlets/ListenHTTPServlet.java
+++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/servlets/ListenHTTPServlet.java
@@ -345,17 +345,6 @@ public class ListenHTTPServlet extends HttpServlet {
} else {
attributes.putAll(unpackager.unpackageFlowFile(in, bos));
- if (destinationIsLegacyNiFi) {
- if (attributes.containsKey("nf.file.name")) {
- // for backward compatibility with old nifi...
- attributes.put(CoreAttributes.FILENAME.key(), attributes.remove("nf.file.name"));
- }
-
- if (attributes.containsKey("nf.file.path")) {
- attributes.put(CoreAttributes.PATH.key(), attributes.remove("nf.file.path"));
- }
- }
-
hasMoreData.set(unpackager.hasMoreData());
}
}