exceptionfactory commented on a change in pull request #5201:
URL: https://github.com/apache/nifi/pull/5201#discussion_r666545629



##########
File path: 
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/UnpackContent.java
##########
@@ -406,50 +399,118 @@ public ZipUnpacker(final Pattern fileFilter, final 
char[] password) {
         @Override
         public void unpack(final ProcessSession session, final FlowFile 
source, final List<FlowFile> unpacked) {
             final String fragmentId = UUID.randomUUID().toString();
-            session.read(source, new InputStreamCallback() {
-                @Override
-                public void process(final InputStream in) throws IOException {
-                    int fragmentCount = 0;
-                    try (final ZipInputStream zipIn = new ZipInputStream(new 
BufferedInputStream(in), password)) {
-                        LocalFileHeader zipEntry;
-                        while ((zipEntry = zipIn.getNextEntry()) != null) {
-                            final String zipEntryName = zipEntry.getFileName();
-                            if (zipEntry.isDirectory() || 
!fileMatches(zipEntryName)) {
-                                continue;
-                            }
-                            final File file = new File(zipEntryName);
-                            final String parentDirectory = (file.getParent() 
== null) ? "/" : file.getParent();
-                            final Path absPath = 
file.toPath().toAbsolutePath();
-                            final String absPathString = 
absPath.getParent().toString() + "/";
-
-                            FlowFile unpackedFile = session.create(source);
-                            try {
-                                final Map<String, String> attributes = new 
HashMap<>();
-                                attributes.put(CoreAttributes.FILENAME.key(), 
file.getName());
-                                attributes.put(CoreAttributes.PATH.key(), 
parentDirectory);
-                                
attributes.put(CoreAttributes.ABSOLUTE_PATH.key(), absPathString);
-                                attributes.put(CoreAttributes.MIME_TYPE.key(), 
OCTET_STREAM);
+            if (password == null) {

Review comment:
       What do you think about adding something to the Password property 
description?  NiFi 1.13.0 introduced support for the Password property and 
changed the library from Apache Commons Compress to Zip4j.  The changes in this 
PR restore the default behavior to use Apache Commons Compress and only use 
Zip4j when a Password is configured.
   
   Zip compression algorithm support depends on the version of Apache Commons 
Compress is not something explicitly advertised, so alternative compression 
algorithms are an edge case, but common enough.




-- 
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.

To unsubscribe, e-mail: [email protected]

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


Reply via email to