Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
Merge pull request #571 from smarthall/ignore-query-string-in-cleanurl
Browse files Browse the repository at this point in the history
Remove the query string from the CleanURL
  • Loading branch information
hiddeco authored Dec 10, 2020
2 parents 797fe26 + 0cfea87 commit 8a3f39f
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions pkg/apis/helm.fluxcd.io/v1/types_helmrelease.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package v1
import (
"encoding/json"
"fmt"
"net/url"
"strings"
"time"

Expand Down Expand Up @@ -226,11 +227,16 @@ type RepoChartSource struct {
ChartPullSecret *LocalObjectReference `json:"chartPullSecret,omitempty"`
}

// CleanRepoURL returns the RepoURL but ensures it ends with a trailing
// slash.
// CleanRepoURL returns the RepoURL but removes the query string and ensures
// it ends with a trailing slash.
func (s RepoChartSource) CleanRepoURL() string {
cleanURL := strings.TrimRight(s.RepoURL, "/")
return cleanURL + "/"
cleanURL, err := url.Parse(s.RepoURL)
if err != nil {
return strings.TrimSuffix(s.RepoURL, "/") + "/"
}
cleanURL.Path = strings.TrimSuffix(cleanURL.Path, "/") + "/"
cleanURL.RawQuery = ""
return cleanURL.String()
}

type ValuesFromSource struct {
Expand Down

0 comments on commit 8a3f39f

Please sign in to comment.