Skip to content

Commit

Permalink
Always use slash (/) when fetching remote files
Browse files Browse the repository at this point in the history
Signed-off-by: Fredrik Skogman <[email protected]>
  • Loading branch information
kommendorkapten committed Feb 21, 2024
1 parent 4389b5e commit 484e95d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion metadata/updater/updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ func (update *Updater) DownloadTarget(targetFile *metadata.TargetFiles, filePath
}

targetFilePath := targetFile.Path
targetRemotePath := targetFilePath
consistentSnapshot := update.trusted.Root.Signed.ConsistentSnapshot
if consistentSnapshot && update.cfg.PrefixTargetsWithHash {
hashes := ""
Expand All @@ -237,12 +238,14 @@ func (update *Updater) DownloadTarget(targetFile *metadata.TargetFiles, filePath
if !ok {
// <hash>.<target-name>
targetFilePath = fmt.Sprintf("%s.%s", hashes, dirName)
targetRemotePath = targetFilePath
} else {
// <dir-prefix>/<hash>.<target-name>
targetFilePath = filepath.Join(dirName, fmt.Sprintf("%s.%s", hashes, baseName))
targetRemotePath = fmt.Sprintf("%s/%s.%s", dirName, hashes, baseName)
}
}
fullURL := fmt.Sprintf("%s%s", targetBaseURL, targetFilePath)
fullURL := fmt.Sprintf("%s%s", targetBaseURL, targetRemotePath)
data, err := update.cfg.Fetcher.DownloadFile(fullURL, targetFile.Length, time.Second*15)
if err != nil {
return "", nil, err
Expand Down

0 comments on commit 484e95d

Please sign in to comment.