comparison 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
comparison
equal deleted inserted replaced
483:02d043b1967d 484:84ca55a0568e
34 34
35 [created, paste, fresh] 35 [created, paste, fresh]
36 end 36 end
37 37
38 def paste_gzip=(paste) 38 def paste_gzip=(paste)
39 self.paste = ActiveSupport::Gzip.decompress paste.read 39 paste = paste.read if paste.is_a? ActionDispatch::Http::UploadedFile
40
41 self.paste = ActiveSupport::Gzip.decompress paste
40 end 42 end
41 43
42 def paste_gzip_base64=(paste) 44 def paste_gzip_base64=(paste)
43 self.paste_gzip = Base64.decode64(paste) 45 self.paste_gzip = Base64.decode64(paste)
44 end 46 end