fix file prefill
This commit is contained in:
committed by
Oleksandr Turchyn
parent
227a067c77
commit
90db64cc03
@@ -48,13 +48,15 @@ module Submissions
|
|||||||
|
|
||||||
submitters.each do |submitter|
|
submitters.each do |submitter|
|
||||||
submitter.values.each_value do |value|
|
submitter.values.each_value do |value|
|
||||||
attachment = attachments_index[value]
|
Array.wrap(value).each do |v|
|
||||||
|
attachment = attachments_index[v]
|
||||||
|
|
||||||
next unless attachment
|
next unless attachment
|
||||||
|
|
||||||
attachment.record = submitter
|
attachment.record = submitter
|
||||||
|
|
||||||
attachment.save!
|
attachment.save!
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ module Submitters
|
|||||||
elsif type.in?(%w[signature initials]) && value.length < 60
|
elsif type.in?(%w[signature initials]) && value.length < 60
|
||||||
find_or_create_blob_from_text(account, value, type)
|
find_or_create_blob_from_text(account, value, type)
|
||||||
elsif (data = Base64.decode64(value.sub(BASE64_PREFIX_REGEXP, ''))) &&
|
elsif (data = Base64.decode64(value.sub(BASE64_PREFIX_REGEXP, ''))) &&
|
||||||
Marcel::MimeType.for(data).include?('image')
|
Marcel::MimeType.for(data).exclude?('octet-stream')
|
||||||
find_or_create_blob_from_base64(account, data, type)
|
find_or_create_blob_from_base64(account, data, type)
|
||||||
else
|
else
|
||||||
raise InvalidDefaultValue, "Invalid value, url, base64 or text < 60 chars is expected: #{value.first(200)}..."
|
raise InvalidDefaultValue, "Invalid value, url, base64 or text < 60 chars is expected: #{value.first(200)}..."
|
||||||
|
|||||||
Reference in New Issue
Block a user