A platform for community discussion. Free, open, simple.
FIX: Don't try to recover an invalid sha1.
Guo Xiang Tan1a64b3a4871c
diff --git a/lib/upload_recovery.rb b/lib/upload_recovery.rbindex fba1a0073d2..ef13002d27b 100644--- a/lib/upload_recovery.rb+++ b/lib/upload_recovery.rb@@ -51,7 +51,7 @@ class UploadRecoveryprivatedef recover_post_upload(post, sha1)- return unless sha1.present?+ return unless sha1.present? && sha1.length == Upload::SHA1_LENGTHattributes = {post: post,diff --git a/spec/lib/upload_recovery_spec.rb b/spec/lib/upload_recovery_spec.rbindex 40225d260e6..17240853400 100644--- a/spec/lib/upload_recovery_spec.rb+++ b/spec/lib/upload_recovery_spec.rb@@ -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.recoverendend