Normalize path outputs emitted by the artifact server download endpoint (#1898)

Co-authored-by: Casey Lee <cplee@nektos.com>
This commit is contained in:
Reisen Usagi 2023-07-10 20:19:30 -03:00 committed by GitHub
parent 3a0a6425a8
commit ef79bb284d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -223,9 +223,13 @@ func downloads(router *httprouter.Router, baseDir string, fsys fs.FS) {
// if it was upload as gzip // if it was upload as gzip
rel = strings.TrimSuffix(rel, gzipExtension) rel = strings.TrimSuffix(rel, gzipExtension)
path := filepath.Join(itemPath, rel)
rel = filepath.ToSlash(rel)
path = filepath.ToSlash(path)
files = append(files, ContainerItem{ files = append(files, ContainerItem{
Path: filepath.Join(itemPath, rel), Path: path,
ItemType: "file", ItemType: "file",
ContentLocation: fmt.Sprintf("http://%s/artifact/%s/%s/%s", req.Host, container, itemPath, rel), ContentLocation: fmt.Sprintf("http://%s/artifact/%s/%s/%s", req.Host, container, itemPath, rel),
}) })