5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-22 05:16:23 +00:00

fix: fallar al final #16388

This commit is contained in:
f 2024-05-28 15:49:47 -03:00
parent 71e5a01e80
commit 019e679fa9
No known key found for this signature in database

View file

@ -27,17 +27,11 @@ module ActiveStorage
site = Site.find_by_name token[:service_name] site = Site.find_by_name token[:service_name]
if remote_file?(token) if remote_file?(token)
begin url = request.body.read
url = request.body.read body = Down.download(url, max_size: 111.megabytes)
body = Down.download(url, max_size: 111.megabytes) checksum = Digest::MD5.file(body.path).base64digest
checksum = Digest::MD5.file(body.path).base64digest blob.metadata[:url] = url
blob.metadata[:url] = url blob.update_columns checksum: checksum, byte_size: body.size, metadata: blob.metadata
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
else else
body = request.body body = request.body
checksum = token[:checksum] checksum = token[:checksum]
@ -54,6 +48,10 @@ module ActiveStorage
end end
rescue ActiveStorage::IntegrityError rescue ActiveStorage::IntegrityError
head :unprocessable_entity 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 end
private private