diff app/models/paste.rb @ 484:84ca55a0568e

Fix pasting base64 gzip and fix tests
author nanaya <me@nanaya.pro>
date Sun, 28 Nov 2021 20:01:18 +0900
parents 02d043b1967d
children d2ef59c9a4b4
line wrap: on
line diff
--- a/app/models/paste.rb	Sun Nov 28 19:54:08 2021 +0900
+++ b/app/models/paste.rb	Sun Nov 28 20:01:18 2021 +0900
@@ -36,7 +36,9 @@
   end
 
   def paste_gzip=(paste)
-    self.paste = ActiveSupport::Gzip.decompress paste.read
+    paste = paste.read if paste.is_a? ActionDispatch::Http::UploadedFile
+
+    self.paste = ActiveSupport::Gzip.decompress paste
   end
 
   def paste_gzip_base64=(paste)