From b545cdbb19a2f6a1d3970c26b600eab27ffedfa3 Mon Sep 17 00:00:00 2001 From: Nick White Date: Thu, 5 Dec 2019 18:19:13 +0000 Subject: Remove (the generally empty) files in the case of a failed download --- aws.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'aws.go') diff --git a/aws.go b/aws.go index 6f7d385..c2aa35e 100644 --- a/aws.go +++ b/aws.go @@ -317,6 +317,9 @@ func (a *AwsConn) Download(bucket string, key string, path string) error { Bucket: aws.String(bucket), Key: &key, }) + if err != nil { + _ = os.Remove(path) + } return err } -- cgit v1.2.1-24-ge1ad