mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 09:42:07 +08: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
|
||||
|
||||
def recover_post_upload(post, sha1)
|
||||
return unless sha1.present?
|
||||
return unless sha1.present? && sha1.length == Upload::SHA1_LENGTH
|
||||
|
||||
attributes = {
|
||||
post: post,
|
||||
|
|
|
@ -55,6 +55,12 @@ RSpec.describe UploadRecovery do
|
|||
)
|
||||
|
||||
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
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user