mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-21 22:56:22 +00:00
fix: fallar al final #16388
This commit is contained in:
parent
71e5a01e80
commit
019e679fa9
1 changed files with 9 additions and 11 deletions
|
@ -27,17 +27,11 @@ module ActiveStorage
|
|||
site = Site.find_by_name token[:service_name]
|
||||
|
||||
if remote_file?(token)
|
||||
begin
|
||||
url = request.body.read
|
||||
body = Down.download(url, max_size: 111.megabytes)
|
||||
checksum = Digest::MD5.file(body.path).base64digest
|
||||
blob.metadata[:url] = url
|
||||
blob.update_columns checksum: checksum, byte_size: body.size, metadata: blob.metadata
|
||||
rescue StandardError => e
|
||||
ExceptionNotifier.notify_exception(e, data: { key: token[:key], url: url, site: site.name })
|
||||
|
||||
head :payload_too_large
|
||||
end
|
||||
url = request.body.read
|
||||
body = Down.download(url, max_size: 111.megabytes)
|
||||
checksum = Digest::MD5.file(body.path).base64digest
|
||||
blob.metadata[:url] = url
|
||||
blob.update_columns checksum: checksum, byte_size: body.size, metadata: blob.metadata
|
||||
else
|
||||
body = request.body
|
||||
checksum = token[:checksum]
|
||||
|
@ -54,6 +48,10 @@ module ActiveStorage
|
|||
end
|
||||
rescue ActiveStorage::IntegrityError
|
||||
head :unprocessable_entity
|
||||
rescue Down::Error => e
|
||||
ExceptionNotifier.notify_exception(e, data: { key: token[:key], url: url, site: site.name })
|
||||
|
||||
head :payload_too_large
|
||||
end
|
||||
|
||||
private
|
||||
|
|
Loading…
Reference in a new issue