ex-aws / ex_aws_s3

170 stars 147 forks source link

download_file with ExAws.request! does not raise even though file was not downloaded completely #55

Open danielkirch opened 5 years ago

danielkirch commented 5 years ago

Environment

Current behavior

Sometimes, if you do

ExAws.S3.download_file(bucket, filename, tmp_file)
|> ExAws.request!

no error is raised even though the file has not been downloaded completely.

Expected behavior

It should raise an ExAws.Error.

We noticed this issue because we save our files with their hash as the filename and we check these hashes after downloading the file.

I think this is related to the :delayed_write option used in download.ex:66, see also https://hexdocs.pm/elixir/File.html#close/1 and http://erlang.org/doc/man/file.html#open-2 . It should be possible to fix this by checking that File.close actually returns :ok in download.ex:84.

sveredyuk commented 9 months ago

+1 to this issue. Sometimes request just returns {:error, :enoent} with no reason