mirror of
https://github.com/discourse/discourse.git
synced 2025-03-30 00:16:19 +08:00
FIX: Handle the case where upload goes missing during downsizing
This commit is contained in:
parent
da0fc0a9d3
commit
cb048d284d
@ -28,7 +28,12 @@ class ShrinkUploadedImage
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Neither #dup or #clone provide a complete copy
|
# Neither #dup or #clone provide a complete copy
|
||||||
original_upload = Upload.find(upload.id)
|
original_upload = Upload.find_by(id: upload.id)
|
||||||
|
unless original_upload
|
||||||
|
log "Upload is missing"
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
ww, hh = ImageSizer.resize(w, h)
|
ww, hh = ImageSizer.resize(w, h)
|
||||||
|
|
||||||
# A different upload record that matches the sha1 of the downsized image
|
# A different upload record that matches the sha1 of the downsized image
|
||||||
|
Loading…
x
Reference in New Issue
Block a user