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

Refactor tidy_unzip() #2028

Merged
merged 2 commits into from
Jul 27, 2024
Merged

Refactor tidy_unzip() #2028

merged 2 commits into from
Jul 27, 2024

Conversation

jennybc
Copy link
Member

@jennybc jennybc commented Jul 27, 2024

Fixes #1961, closes #1962.

Analyzing the above gave me a new/different understanding of common ZIP file organization structures. I think I've got a better heuristic for setting exdir.

jennybc added 2 commits July 27, 2024 15:32
Fixes #1961, closes #1962.

Analyzing the above gave me a new/different understanding of common ZIP file organization structures. I think I've got a better heuristic for setting `exdir`.
@jennybc
Copy link
Member Author

jennybc commented Jul 27, 2024

In tests/testthat/ref/README.md I now have a good origin story for the different ways ZIP archives are organized:

  • "Explicit parent" is what you get with zip -r foo-explicit-parent.zip foo/.Note that foo/ is there, in its own right:

    ~/rrr/usethis/tests/testthat/ref % unzip -Z1 foo-explicit-parent.zip
    foo/
    foo/file.txt
    
  • "Implicit parent" is what you get with zip -r foo-implicit-parent.zip foo/*. This is the form reported in use_zip error in unzipping directory with a different name from the zipfile #1961. Note that the original existence of foo/ is evident from the filepath but also only from the filepath:

    ~/rrr/usethis/tests/testthat/ref % unzip -Z1 foo-implicit-parent.zip
    foo/file.txt
    
  • "No parent" is what you get with (cd foo && zip -r ../foo-no-parent.zip .). No evidence that file.txt ever lived in foo/:

    ~/rrr/usethis/tests/testthat/ref % unzip -Z1 foo-no-parent.zip
    file.txt
    

@jennybc jennybc merged commit 00341c1 into main Jul 27, 2024
14 checks passed
@jennybc jennybc deleted the refactor-tidy-unzip branch July 28, 2024 16:29
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.

use_zip error in unzipping directory with a different name from the zipfile
1 participant