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

merge_archives creating corrupted archives #271

Open
JulianDicken opened this issue Dec 26, 2024 · 0 comments
Open

merge_archives creating corrupted archives #271

JulianDicken opened this issue Dec 26, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@JulianDicken
Copy link

JulianDicken commented Dec 26, 2024

Describe the bug
Merging archives via merge_archives creates a corrupt archive => Using a zip file viewer shows the files as existing but the archive is not able to be decompressed

To Reproduce

let rdb_output_file = File::create(&self.path_out).unwrap();
        let mut rdb_output_bufwriter = BufWriter::new(&rdb_output_file);
        let mut rdb_output_zipwriter = ZipWriter::new(&mut rdb_output_bufwriter);

        for thread_path_out in thread_paths_out {
            let rdb_temp_file = File::open(&thread_path_out)?;
            let rdb_temp_archive = ZipArchive::new(rdb_temp_file)?;
            rdb_output_zipwriter.merge_archive(rdb_temp_archive)?;
        }
        rdb_output_zipwriter.finish().unwrap();

Desktop (please complete the following information):

  • OS: macOS Sequoia 15.11
  • Version 2.2.2

Additional context

let rdb_output_file = File::create(&self.path_out).unwrap();
        let mut rdb_output_bufwriter = BufWriter::new(&rdb_output_file);
        let mut rdb_output_zipwriter = ZipWriter::new(&mut rdb_output_bufwriter);

        for thread_path_out in thread_paths_out {
            let rdb_temp_file = File::open(&thread_path_out).unwrap();
            let mut rdb_temp_archive = ZipArchive::new(&rdb_temp_file).unwrap();

            for i in 0..rdb_temp_archive.len() {
                let file = rdb_temp_archive.by_index(i)?;
                rdb_output_zipwriter.raw_copy_file(file)?;
            }
            // fs::remove_file(&thread_path_out).unwrap();
        }
        rdb_output_zipwriter.finish().unwrap();

or using the zipmerge command line tool works. The individual archives are also extractable.

@JulianDicken JulianDicken added the bug Something isn't working label Dec 26, 2024
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

1 participant