You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2021/08/05 10:49:38 UTC
[GitHub] [nifi-minifi-cpp] adamdebreceni commented on a change in pull request #1153: MINIFICPP-1622 Fix filename update of CompressContent in case of tar.gz
adamdebreceni commented on a change in pull request #1153:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1153#discussion_r683343728
##########
File path: extensions/libarchive/CompressContent.cpp
##########
@@ -191,14 +194,20 @@ void CompressContent::processFlowFile(const std::shared_ptr<core::FlowFile>& flo
if (compressMode_ == CompressionMode::Compress) {
session->putAttribute(result, core::SpecialFlowAttribute::MIME_TYPE, mimeType);
if (updateFileName_) {
+ if (encapsulateInTar_) {
+ fileName = fileName + TAR_EXT;
+ }
fileName = fileName + fileExtension;
session->putAttribute(result, core::SpecialFlowAttribute::FILENAME, fileName);
}
} else {
session->removeAttribute(result, core::SpecialFlowAttribute::MIME_TYPE);
if (updateFileName_) {
- if (fileName.size() >= fileExtension.size() && fileName.compare(fileName.size() - fileExtension.size(), fileExtension.size(), fileExtension) == 0) {
+ if (utils::StringUtils::endsWith(fileName, fileExtension)) {
fileName = fileName.substr(0, fileName.size() - fileExtension.size());
+ if (encapsulateInTar_ && utils::StringUtils::endsWith(fileName, TAR_EXT)) {
Review comment:
using the `encapsulateInTar_` during decompression seems strange, shouldn't we infer the need for "de-tar-ing" only from the extension?
--
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: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org