-
- Downloads
Fix: Handle OCI artifact versions with '+' correctly
This change addresses an issue where Helm's automatic replacement of '+' with '_' in version strings causes problems with OCI artifact registries that do not support '+' in tags. The following improvements have been made: - Modified `internal/helper/helper.go`: - Added comprehensive documentation to the `SemVerReplace` function. - Clarified that `SemVerReplace` focuses on underscore-to-plus conversion and does not perform full semver validation. - Simplified the `SemVerReplace` function logic. - Added extensive unit tests for `SemVerReplace` covering various scenarios, including empty strings, multiple underscores, leading/trailing underscores, and mixed-case strings. - Updated `internal/manifest/charts.go`: - Added debug logging before attempting underscore-to-plus conversion for chart versions. - Enhanced error messages to be more specific when a chart version is not found, indicating that lookups were attempted with both the original reference and the converted reference. - Updated `internal/manifest/manifest.go`: - Ensured consistent handling of underscore-to-plus conversion for manifest targets in both GET and HEAD request methods. - Added debug logging before attempting underscore-to-plus conversion for manifest targets in both GET and HEAD methods. - Enhanced error messages to be more specific when a manifest is not found, indicating that lookups were attempted with both the original target and the converted target. These changes ensure that versions containing '+' are correctly processed by first attempting the lookup with the original reference (which might contain '_') and then, if that fails, by attempting the lookup again after converting underscores to plus signs. This provides more robust handling for OCI artifacts and improves debuggability.
Showing
- internal/helper/helper.go 61 additions, 3 deletionsinternal/helper/helper.go
- internal/helper/helper_test.go 73 additions, 0 deletionsinternal/helper/helper_test.go
- internal/manifest/charts.go 11 additions, 1 deletioninternal/manifest/charts.go
- internal/manifest/manifest.go 30 additions, 11 deletionsinternal/manifest/manifest.go
Loading
Please register or sign in to comment