Claus Ibsen created CAMEL-26008:
-----------------------------------

             Summary: camel-zipfile - unmarshal of a zip or tar archive with a 
folder entry fails as more than one entry
                 Key: CAMEL-26008
                 URL: https://issues.apache.org/jira/browse/CAMEL-26008
             Project: Camel
          Issue Type: Bug
          Components: camel-zipfile
    Affects Versions: 4.18.0, 4.22.0, 4.23.0
            Reporter: Claus Ibsen
             Fix For: 4.24.0


Without {{usingIterator}}, the zipFile and tarFile data formats unmarshal an 
archive with one entry, and fail when it has more ({{ZipFileDataFormat}}, main 
56aa5f4970a6, line 128; {{TarFileDataFormat}}, line 125). A folder entry counts 
as an entry. So an archive of a folder with one file, as {{zip -r}} or {{tar 
cf}} make it, fails with "Zip file has more than 1 entry." or "Tar file has 
more than 1 entry.". So does an archive made by the same data format's marshal 
with {{preservePathElements=true}}, which writes the folder entries of the path 
(read from the code).

Checked on 4.24.0-SNAPSHOT with {{camel run}}, with a folder {{d}} holding 
{{a.txt}}:
* {{zip -r dz.zip d}} (entries {{d/}} and {{d/a.txt}}), then {{unmarshal: 
zipFile}}: IllegalStateException "Zip file has more than 1 entry.";
* {{tar cf dt.tar d}}, then {{unmarshal: tarFile}}: "Tar file has more than 1 
entry.".

*Proposed change*: skip folder entries when looking for the one entry, as the 
iterators do unless allowEmptyDirectory is set.

_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to