[deckhouse-cli] fix: mirror: correct URL parsing for VEX images with port in registry address #253
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.
Description:
Problem
When running
d8 mirror pullfrom a local registry with a port (e.g.,localhost:443/deckhouse-etalon), the command fails with:The same command works correctly with remote
registry.deckhouse.ru.Root Cause
The
FindVexImagefunction usesstrings.SplitN(url, ":", 2)to split the URL into path and tag. For URLs containing a port, this splits at the first colon (the port separator) instead of the last colon (the tag separator):This incorrect parsing led to path duplication when constructing the final reference.
Solution
strings.SplitNwithstrings.LastIndexto find the last colon (before the tag)CheckImageExists— previously, errors other thanErrImageNotFoundwere silently ignoredFiles Changed
pkg/libmirror/images/digests.gopkg/libmirror/layouts/layouts.goNotes
NEW_PULL=trueininternal/mirror/platform/platform.go) already usesstrings.LastIndexand doesn't have this issue