build: fix gocritic lint issue wrapperfunc

This commit is contained in:
albertony
2024-05-31 15:25:27 +02:00
committed by Nick Craig-Wood
parent e82b5b11af
commit 33bff6fe71
9 changed files with 17 additions and 19 deletions

View File

@@ -1807,7 +1807,7 @@ func copyURLFn(ctx context.Context, dstFileName string, url string, autoFilename
if autoFilename {
if dstFileNameFromHeader {
_, params, err := mime.ParseMediaType(resp.Header.Get("Content-Disposition"))
headerFilename := path.Base(strings.Replace(params["filename"], "\\", "/", -1))
headerFilename := path.Base(strings.ReplaceAll(params["filename"], "\\", "/"))
if err != nil || headerFilename == "" {
return fmt.Errorf("CopyURL failed: filename not found in the Content-Disposition header")
}