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

ZIP #118

Merged
merged 6 commits into from
Mar 8, 2023
Merged

ZIP #118

merged 6 commits into from
Mar 8, 2023

Conversation

jasonw930
Copy link
Contributor

Description

ZIP

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Note: make sure your files are formatted with rust-analyzer

@jasonw930 jasonw930 changed the base branch from main to releases/0.4.3 February 22, 2023 21:56
Copy link
Member

@CheatCod CheatCod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some test cases would be nice :)

@CheatCod CheatCod linked an issue Feb 28, 2023 that may be closed by this pull request
@CheatCod
Copy link
Member

There is a bug involved in the old unzip logic, where the function does a diff of the destination dir before and after the unzip. So if the unzip overwrote some files, the file paths are not returned.

The desired behavior will be to get the content of the archive (listing the files in the temp dir)

let archive = unrar::Archive::new(file.to_str().ok_or_else(|| eyre!("Non-unicode character in file name {}", file.display()))?.to_string());
archive
.extract_to(temp_dest.to_str().ok_or_else(|| eyre!("Non-unicode character in file name {}", temp_dest.display()))?.to_string())
.map_err(|_| eyre!("Failed to decompress file {}", file.display()))?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use .context

.extract_to(temp_dest.to_str().ok_or_else(|| eyre!("Non-unicode character in file name {}", temp_dest.display()))?.to_string())
.map_err(|_| eyre!("Failed to decompress file {}", file.display()))?
.process()
.map_err(|_| eyre!("Failed to decompress file {}", file.display()))?;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.context

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: the following trait bounds were not satisfied:
UnrarError<Vec<unrar::archive::Entry>>: eyre::context::ext::StdError

They didn't make their error type good I guess

Copy link
Member

@CheatCod CheatCod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add test case for .tar.gz

@jasonw930 jasonw930 requested a review from CheatCod March 2, 2023 02:51
Copy link
Member

@CheatCod CheatCod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please install clippy and watch out for minor details such as unused deps

@CheatCod CheatCod merged commit b0979dd into releases/0.4.3 Mar 8, 2023
@CheatCod CheatCod deleted the dev/zip branch March 14, 2023 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rewrite unzipping logic with libraries instead of 7z
2 participants