Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

file attributes of zipped folders are not applied on extraction #268

Closed
schwammk opened this issue Dec 18, 2020 · 2 comments
Closed

file attributes of zipped folders are not applied on extraction #268

schwammk opened this issue Dec 18, 2020 · 2 comments
Assignees
Labels
bug Something isn't working resolved

Comments

@schwammk
Copy link

schwammk commented Dec 18, 2020

there is this piece of code in AbstractExtractFileTask.java

    if (fileHeader.isDirectory()) {  
        if (!outputFile.exists()) {  
            if (!outputFile.mkdirs()) {  
                throw new ZipException("Could not create directory: " + outputFile);  
            }  
        }  
    } else if (isSymbolicLink(fileHeader)) {  

so whenever the extraction comes across a directory in the zip file, upon visiting or creating it the attributes stored in the zip won't get applied. I guess this could be fixed by the following (I successfully tested on Windows with hidden dirs):

    if (fileHeader.isDirectory()) {
        if (!outputFile.exists()) {
            if (!outputFile.mkdirs()) {
                throw new ZipException("Could not create directory: " + outputFile);
            }
        }
        UnzipUtil.applyFileAttributes(fileHeader, outputFile);
    } else if (isSymbolicLink(fileHeader)) {

This would need some testing on Linux/Mac as well. Which I cannot do right now. Especially some obscure settings might prevent e.g. other files from being extracted into read-only folders afterwards etc.

@srikanth-lingala
Copy link
Owner

You are right. This file attributes should be applied in the if-block as you mentioned. I will test this on mac/linux and include a fix in the next release.

@srikanth-lingala
Copy link
Owner

Issue fixed in v2.7.0 which was released today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working resolved
Projects
None yet
Development

No branches or pull requests

2 participants