From f89f70a3ec59d7bf93735d58179e4d50612fe291 Mon Sep 17 00:00:00 2001 From: Ernst von Oelsen Date: Wed, 4 Dec 2024 11:28:47 +0100 Subject: [PATCH] Parse relPath without potential query params. --- pkg/files/file.go | 1 - pkg/files/sources.go | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/files/file.go b/pkg/files/file.go index ea4a3199..6a956919 100644 --- a/pkg/files/file.go +++ b/pkg/files/file.go @@ -77,7 +77,6 @@ func NewSortedFilesFromPaths(paths []string, opts SymlinkAllowOpts) ([]*File, er case strings.HasPrefix(path, "http://") || strings.HasPrefix(path, "https://"): file, err := NewFileFromSource(NewCachedSource(NewHTTPSource(path))) - file.relPath = strings.Split(file.relPath, "?")[0] if err != nil { return nil, err } diff --git a/pkg/files/sources.go b/pkg/files/sources.go index 9c01f945..47ec54e3 100644 --- a/pkg/files/sources.go +++ b/pkg/files/sources.go @@ -97,7 +97,9 @@ func (s HTTPSource) Description() string { return fmt.Sprintf("HTTP URL '%s'", s.url) } -func (s HTTPSource) RelativePath() (string, error) { return path.Base(s.url), nil } +func (s HTTPSource) RelativePath() (string, error) { + return path.Base(strings.Split(s.url, "?")[0]), nil +} func (s HTTPSource) Bytes() ([]byte, error) { resp, err := s.Client.Get(s.url)