lordgamez commented on a change in pull request #1153:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1153#discussion_r683353174



##########
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:
       Currently the "de-tar-ing" depends on the `Encapsulate in TAR` property 
in the processor, so if that is not set in decompression only the "gunzip" 
operation will be run on the data and the end content will still be 
encapsulated in tar. That is why I followed this same process in the filename 
changes.




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