Add .crate and .vsix extension aliases - #26
Merged
Merged
Conversation
Route .crate to the gzipped-tar reader and .vsix to the zip reader in detectFormat so they open without falling back to content sniffing. .apk is left to the sniff fallback since Android packages are zip and Alpine packages are gzipped tar; add tests pinning both variants and document all three in the README. Closes #21
There was a problem hiding this comment.
Pull request overview
This PR makes support for common package-registry artifact extensions explicit by mapping .crate and .vsix directly to the existing tar.gz and zip readers (respectively), while keeping .apk on the content-sniff path because it’s physically ambiguous (Android ZIP vs Alpine tar.gz). It also updates documentation and adds targeted tests to prevent regressions in extension routing vs sniff routing.
Changes:
- Route
.vsixto the ZIP reader and.crateto the gzipped-tar reader viadetectFormat. - Add
TestOpenRegistryArtifactExtensionsto pin concrete reader types for.crate,.vsix, and both.apkvariants acrossOpenandOpenBytes. - Update README and package docs to list the new aliases and document the unrecognised-extension sniff fallback.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| README.md | Documents .vsix, .crate, .apk handling and the unrecognised-extension content sniff behavior. |
| archives.go | Extends detectFormat extension routing for .vsix and .crate, and clarifies .apk behavior in docs/comments. |
| archives_test.go | Adds tests that lock in expected routing behavior and reader concrete types for registry artifact extensions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Routes
.crateto the gzipped-tar reader and.vsixto the zip reader indetectFormatso they open without falling back to content sniffing..apkis deliberately left out of the extension switch since Android packages are zip and Alpine packages are gzipped tar; it falls through to the content-sniff path added in #20, which handles both.TestOpenRegistryArtifactExtensionspins the concrete reader type for all four cases so a regression in the sniff routing shows up.README format list updated and now also mentions the unrecognised-extension sniff behaviour from #20.
Closes #21.