mirror of
https://github.com/discourse/discourse.git
synced 2025-02-22 12:17:12 +00:00
FIX: Don't try to recover an invalid sha1.
This commit is contained in:
parent
df45e82377
commit
1a64b3a487
@ -51,7 +51,7 @@ class UploadRecovery
|
|||||||
private
|
private
|
||||||
|
|
||||||
def recover_post_upload(post, sha1)
|
def recover_post_upload(post, sha1)
|
||||||
return unless sha1.present?
|
return unless sha1.present? && sha1.length == Upload::SHA1_LENGTH
|
||||||
|
|
||||||
attributes = {
|
attributes = {
|
||||||
post: post,
|
post: post,
|
||||||
|
@ -55,6 +55,12 @@ RSpec.describe UploadRecovery do
|
|||||||
)
|
)
|
||||||
|
|
||||||
upload_recovery.recover
|
upload_recovery.recover
|
||||||
|
|
||||||
|
post.update!(
|
||||||
|
raw: "<a href=#{"/uploads/test/original/3X/a/6%0A/#{upload.sha1}.png"}>test</a>"
|
||||||
|
)
|
||||||
|
|
||||||
|
upload_recovery.recover
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user