From 8b1c28427fb77c08aec8f5335faa457175e45b55 Mon Sep 17 00:00:00 2001 From: Guy Bolton King Date: Thu, 20 Jan 2022 11:37:45 +0000 Subject: [PATCH] Make repo_add.go only replace the last suffix in the path when generating a lockfile Signed-off-by: Guy Bolton King --- cmd/helm/repo_add.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/helm/repo_add.go b/cmd/helm/repo_add.go index 8844174be..fa945e739 100644 --- a/cmd/helm/repo_add.go +++ b/cmd/helm/repo_add.go @@ -119,7 +119,7 @@ func (o *repoAddOptions) run(out io.Writer) error { repoFileExt := filepath.Ext(o.repoFile) var lockPath string if len(repoFileExt) > 0 && len(repoFileExt) < len(o.repoFile) { - lockPath = strings.Replace(o.repoFile, repoFileExt, ".lock", 1) + lockPath = strings.TrimSuffix(o.repoFile, repoFileExt) + ".lock" } else { lockPath = o.repoFile + ".lock" }