mattyb149 commented on a change in pull request #5201:
URL: https://github.com/apache/nifi/pull/5201#discussion_r666542284
##########
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:
Is there a good place in the docs to mention this? Maybe the description
of the password property? I realize it's under the hood but seems like we
should mention it in case of regressions, unexpected/changed behavior, etc.?
--
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]