Add EntryContent decoded view for NormalEntry - #3207
Conversation
📝 WalkthroughWalkthroughAdds a public ChangesEntry content decoding and CLI integration
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request introduces the EntryContent enum and the NormalEntry::content method to provide a decoded view of entry data based on its DataKind. It refactors the CLI commands (diff, extract, and list) to use this new API for handling symbolic and hard links instead of manually reading and decoding the entry data. Comprehensive unit tests are also added for the new functionality. There are no review comments, and I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@lib/src/entry/content.rs`:
- Around line 57-59: Update read_reference to enforce a small maximum
link-target size while reading the payload, before converting it with
EntryReference::from_utf8_preserve_root. Return an io::Error with InvalidData
when the target exceeds the limit, avoiding unbounded read_to_string allocation
and preserving the existing successful decoding path.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 37f641f1-b1da-43df-b77e-712ac400e25d
📒 Files selected for processing (5)
cli/src/command/diff.rscli/src/command/extract.rscli/src/command/list.rslib/src/entry.rslib/src/entry/content.rs
Summary
Add
EntryContent, a decoded view enum forNormalEntrythat interprets entry data according to itsDataKind, and migrate the manual link-target decoding inextract,diffandlistto it. This moves per-kind payload interpretation (decrypt → UTF-8 validation →EntryReferencerestoration) from CLI call sites into libpna.Notes
EntryReference::from_utf8_preserve_root, so absolute targets round-trip without sanitization.Directorynever touches entry data: it decodes without a password even when the header claims encryption, and stray data on malformed archives is ignored.EntryContentis#[non_exhaustive];Reserved/Privatekinds surface asUnknown(kind, reader)with the raw decoded bytes.list's"-"fallback).Summary by CodeRabbit
New Features
Bug Fixes