Fix files being deleted after being uploaded to S3

This bug was introduced attempting to fix CLDCONNECT-796.
Merge branch 'master' into CLDCONNECT-1435