Skip to content

Commit 0d1d938

Browse files
committed
#2327 Avoid error case which prevented empty scan result files from being uploaded correctly
Signed-off-by: Jannik Hollenbach <jannik.hollenbach@iteratec.com>
1 parent e396794 commit 0d1d938

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

lurker/main.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ func uploadFile(path, url string) error {
8787
}
8888

8989
req.ContentLength = size
90+
// with the default TransferEncoding golang sends out the requests for empty files without
91+
// the required Content-Length header this is valid, but not accepted by S3 compatible APIs
92+
if size == 0 {
93+
req.TransferEncoding = []string{"identity"}
94+
}
95+
9096
client := &http.Client{}
9197

9298
res, err := client.Do(req)

0 commit comments

Comments
 (0)