mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-22 10: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]
|
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
|
||||||
|
|
Loading…
Reference in a new issue