Skip to content

fix: show "Directory ... created" instead of misleading byte size#944

Closed
mvanhorn wants to merge 1 commit intoouch-org:mainfrom
mvanhorn:fix-directory-unpack-output
Closed

fix: show "Directory ... created" instead of misleading byte size#944
mvanhorn wants to merge 1 commit intoouch-org:mainfrom
mvanhorn:fix-directory-unpack-output

Conversation

@mvanhorn
Copy link
Copy Markdown

Summary

Unifies directory output messages across tar and zip archive unpacking.

Why this matters

When unpacking archives, directory entries showed confusing output:

  • zip (src/archive/zip.rs:56): "File 12 extracted to \"src/commands/\"" - directories aren't files
  • tar (src/archive/tar.rs:83): "extracted (0 B) \"src/commands\"" - the 0 B size is misleading

Both should show the same clear message indicating a directory was created.

Changes

  • src/archive/zip.rs: Changed directory branch to print "Directory {path} created" instead of "File {idx} extracted to {path}"
  • src/archive/tar.rs: Added entry.header().entry_type().is_dir() check so directories print "Directory {path} created" while regular files keep the existing "extracted ({bytes}) {path}" format
  • Updated snapshot test to match the new output

Testing

cargo test passes (13/13 tests). Snapshot updated for ui_test_ok_decompress_multiple_files.

Fixes #328

This contribution was developed with AI assistance (Claude Code).

When unpacking archives, directory entries showed inconsistent and
confusing messages:
- zip: "File N extracted to path" (directories aren't files)
- tar: "extracted (0 B) path" (0 B is misleading for directories)

Both now show "Directory path created" for directory entries while
keeping the existing "extracted (size) path" for regular files.

Fixes ouch-org#328
@marcospb19
Copy link
Copy Markdown
Member

marcospb19 commented Mar 20, 2026

Hi!

Great PR, but by a huge coincidence this change was just covered by this other PR: #937

That one came first so I'll prioritize that one, don't want to desincentivize improvements like this one tho, we very much appreciate these.

@marcospb19 marcospb19 closed this Mar 20, 2026
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.

Improve unpacking output when creating an empty directory

2 participants