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

Add a file as a stream, with the file name repeated, not overwritten #70

Closed
l54808821 opened this issue Sep 26, 2019 · 2 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@l54808821
Copy link

    ZipParameters zipParameters = new ZipParameters();
    zipParameters.setFileNameInZip("data/result.csv");
    ZipFile zipFile = new ZipFile("D:\\浏览器下载路径\\jmeterTemplate.zip");
    List<FileHeader> fileHeaders = zipFile.getFileHeaders();
    for (FileHeader fileHeader : fileHeaders) {
        new ZipFile("D:\\浏览器下载路径\\aaa.zip").addStream(zipFile.getInputStream(fileHeader), zipParameters);
        System.out.println(fileHeader.getFileName());
    }

image

@LeeYoung624
Copy link
Contributor

LeeYoung624 commented Sep 27, 2019

I think you are adding files via addStream and set different files to the same name by ZipParameters. I don't know why would you do this.
There is a remove if file exist detect in addFile, and a override flag overrideExistingFilesInZip in ZipParameters. Maybe you can try this.

@srikanth-lingala Maybe we can add the remove if file exist in ZipOutputStream?
Besides, I think we should take the fileNameInZip into account when checking the existing file in zip.

@srikanth-lingala srikanth-lingala self-assigned this Sep 29, 2019
@srikanth-lingala srikanth-lingala added the bug Something isn't working label Sep 29, 2019
@srikanth-lingala
Copy link
Owner

Fixed in v2.2.1

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

No branches or pull requests

3 participants