Repository navigation
feat(restore): encode source registry hosts with ports for --preserve-source-registry - #2402
Merged
TerryHowe merged 2 commits intoNov 27, 2026
Conversation
…-source-registry Encode the source registry host as a repository path component instead of rejecting hosts with a port: the host is lowercased and the ':' before a port is replaced by '_' (registry.lan:5000 -> registry.lan_5000). Host names cannot contain '_', so different hosts never encode to the same component. IPv6 literal hosts are rejected with a recommendation. Reject target repositories longer than 255 characters before anything is pushed, as oras-go only validates the repository pattern. Fixes oras-project#2398 Signed-off-by: orion777-cmd <[email protected]>
Orion777-cmd
requested review from
TerryHowe,
Wwwsylvia,
sabre1041,
sajayantony and
shizhMSFT
as code owners
November 27, 2026 20:35
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2402 +/- ##
==========================================
+ Coverage 90.86% 90.93% +0.06%
==========================================
Files 158 158
Lines 7172 7180 +8
==========================================
+ Hits 6517 6529 +12
+ Misses 382 380 -2
+ Partials 273 271 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…eTargets Signed-off-by: orion777-cmd <[email protected]>
8 tasks
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.
What this PR does / why we need it:
--preserve-source-registrynow encodes the source registry host as a repository path component instead of rejecting hosts with a port, as described in #2358: the host is lowercased and the port:is replaced by_(registry.lan:5000→registry.lan_5000). IPv6 literal hosts are rejected with a recommendation. Target repositories longer than 255 characters are rejected before anything is pushed, sinceproperties.NewReferenceonly checks the pattern.Two notes from implementing it:
properties.NewReferencealready lowercases the registry, so uppercase hosts worked with the flag before this change, andRegistry.example.com/appandregistry.example.com/appare the same source rather than a collision.a:5000anda_5000do collide and are reported.--dry-runneeded no change; it prints the encoded targets.Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)format, will close the issue(s) when PR gets merged):Fixes #2398
Please check the following list: