summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick White <git@njw.name>2019-12-05 18:19:13 +0000
committerNick White <git@njw.name>2019-12-05 18:19:13 +0000
commitb545cdbb19a2f6a1d3970c26b600eab27ffedfa3 (patch)
tree1c4f0865a88e4c80705612cb3c1a7a0ebefd6a74
parent2318b478fc2769ca09590006d8483463ae763b22 (diff)
Remove (the generally empty) files in the case of a failed download
-rw-r--r--aws.go3
1 files changed, 3 insertions, 0 deletions
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
}