Focus on tgz

https://github.com/helm/helm/pull/31206#discussion_r2328036710

Signed-off-by: Benoit Tigeot <benoit.tigeot@lifen.fr>
pull/31206/head
Benoit Tigeot 3 weeks ago
parent df391c0324
commit 5b0dc8f021
No known key found for this signature in database
GPG Key ID: 8E6D4FC8AEBDA62C

@ -152,7 +152,7 @@ func (p *Pull) Run(chartRef string) (string, error) {
// For direct OCI pulls, the registry client already prints "Pulled:" and
// "Digest:" (manifest digest), so we do not print here to avoid duplicates.
if p.RepoURL != "" || !registry.IsOCI(downloadSourceRef) {
base := trimAnySuffix(downloadSourceRef, ".tar.gz", ".tgz")
base := strings.TrimSuffix(downloadSourceRef, ".tgz")
chart, ver := splitChartNameVersion(base)
tag := chart
@ -206,15 +206,6 @@ func (p *Pull) Run(chartRef string) (string, error) {
return out.String(), nil
}
func trimAnySuffix(s string, suffixes ...string) string {
for _, suf := range suffixes {
if strings.HasSuffix(s, suf) {
return strings.TrimSuffix(s, suf)
}
}
return s
}
func splitChartNameVersion(s string) (name, version string) {
if i := strings.LastIndex(s, "-"); i >= 0 {
return s[:i], s[i+1:]

Loading…
Cancel
Save