diff --git a/internal/utils/utils.go b/internal/utils/utils.go index c7a81d1bb0..3059381535 100644 --- a/internal/utils/utils.go +++ b/internal/utils/utils.go @@ -118,9 +118,20 @@ func FetchBeatsBinary(artifactName string, artifact string, version string, fall return filePath, err } - binariesCache[URL] = filePath + // use artifact name as file name to avoid having URL params in the name + sanitizedFilePath := path.Join(path.Dir(filePath), artifactName) + err = os.Rename(filePath, sanitizedFilePath) + if err != nil { + log.WithFields(log.Fields{ + "fileName": filePath, + "sanitizedFileName": sanitizedFilePath, + }).Warn("Could not sanitize downloaded file name. Keeping old name") + sanitizedFilePath = filePath + } + + binariesCache[URL] = sanitizedFilePath - return filePath, nil + return sanitizedFilePath, nil } var downloadURL string