mirror of
https://github.com/internetee/registry.git
synced 2025-05-18 02:09:39 +02:00
Story#119627029 - less base64 decodings
This commit is contained in:
parent
7ef8ad5a46
commit
16ff42a5a5
1 changed files with 3 additions and 3 deletions
|
@ -32,9 +32,9 @@ class LegalDocument < ActiveRecord::Base
|
||||||
|
|
||||||
|
|
||||||
def save_to_filesystem
|
def save_to_filesystem
|
||||||
|
|
||||||
digest = Digest::SHA1.new
|
digest = Digest::SHA1.new
|
||||||
ld = LegalDocument.where(checksum: digest.update(Base64.decode64(body)))
|
binary = Base64.decode64(body)
|
||||||
|
ld = LegalDocument.where(checksum: digest.update(binary))
|
||||||
|
|
||||||
if !ld
|
if !ld
|
||||||
loop do
|
loop do
|
||||||
|
@ -47,7 +47,7 @@ class LegalDocument < ActiveRecord::Base
|
||||||
break unless File.file?(path)
|
break unless File.file?(path)
|
||||||
end
|
end
|
||||||
|
|
||||||
File.open(path, 'wb') { |f| f.write(Base64.decode64(body)) } unless Rails.env.test?
|
File.open(path, 'wb') { |f| f.write(binary) } unless Rails.env.test?
|
||||||
self.path = path
|
self.path = path
|
||||||
else
|
else
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue