Client fix: don't try to put files when too big.

This commit is contained in:
Karchnu 2020-10-22 02:08:12 +02:00
parent 2bea44d119
commit 2cd758317a

View File

@ -112,13 +112,17 @@ def put(client : FileStorage::Client)
end end
files.each do |file| files.each do |file|
file_info = File.open(file) do |f|
FileStorage::FileInfo.new f
end
response = client.upload file response = client.upload file
if response.is_a?(FileStorage::Errors::FileFullyUploaded) case response
file_info = File.open(file) do |f| when FileStorage::Errors::FileFullyUploaded
FileStorage::FileInfo.new f
end
Baguette::Log.warning "file #{file} already uploaded, digest: #{file_info.digest}" Baguette::Log.warning "file #{file} already uploaded, digest: #{file_info.digest}"
next next
when FileStorage::Errors::FileTooBig
Baguette::Log.warning "file #{file} too big, accepting up to #{response.limit} bytes"
next
end end
Baguette::Log.info "transfering: #{file}" Baguette::Log.info "transfering: #{file}"
client.transfer file client.transfer file