pull/781/merge
Michelle Noorali 9 years ago
commit 86b90d65a6

@ -131,7 +131,7 @@ func (r *ChartRepository) Index() error {
created = time.Now().UTC().String() created = time.Now().UTC().String()
} }
url := filepath.Join(r.URL, key+".tgz") url := strings.TrimSuffix(r.URL, "/") + "/" + key + ".tgz"
entry := &ChartRef{Chartfile: *chartfile, Name: chartfile.Name, URL: url, Created: created, Checksum: hash, Removed: false} entry := &ChartRef{Chartfile: *chartfile, Name: chartfile.Name, URL: url, Created: created, Checksum: hash, Removed: false}

@ -4,6 +4,7 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"reflect" "reflect"
"strings"
"testing" "testing"
"time" "time"
) )
@ -90,7 +91,7 @@ func TestIndex(t *testing.T) {
if v.Created != created { if v.Created != created {
t.Errorf("Expected Created timestamp to be %s, but got %s for chart %s", created, v.Created, chart) t.Errorf("Expected Created timestamp to be %s, but got %s for chart %s", created, v.Created, chart)
} }
expectedURL := filepath.Join(cr.URL, chart+".tgz") expectedURL := strings.TrimSuffix(cr.URL, "/") + "/" + chart + ".tgz"
if v.URL != expectedURL { if v.URL != expectedURL {
t.Errorf("Expected url in entry to be %s but got %s for chart: %s", expectedURL, v.URL, chart) t.Errorf("Expected url in entry to be %s but got %s for chart: %s", expectedURL, v.URL, chart)
} }

Loading…
Cancel
Save