Client fix: don't try to put files when too big.
This commit is contained in:
parent
2bea44d119
commit
2cd758317a
@ -112,13 +112,17 @@ def put(client : FileStorage::Client)
|
|||||||
end
|
end
|
||||||
|
|
||||||
files.each do |file|
|
files.each do |file|
|
||||||
response = client.upload file
|
|
||||||
if response.is_a?(FileStorage::Errors::FileFullyUploaded)
|
|
||||||
file_info = File.open(file) do |f|
|
file_info = File.open(file) do |f|
|
||||||
FileStorage::FileInfo.new f
|
FileStorage::FileInfo.new f
|
||||||
end
|
end
|
||||||
|
response = client.upload file
|
||||||
|
case response
|
||||||
|
when FileStorage::Errors::FileFullyUploaded
|
||||||
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
|
||||||
|
Loading…
Reference in New Issue
Block a user