Merge pull request #3073 from betagouv/fix-sentry-26

[Fix sentry-26] if file does not exist, filename should be nil
This commit is contained in:
Mathieu Magnin 2018-11-27 14:29:08 +01:00 committed by GitHub
commit 489cf7c855
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -25,14 +25,16 @@ class ProcedureLogoUploader < BaseUploader
end
def filename
if original_filename.present? || model.logo_secure_token
if Flipflop.remote_storage?
filename = "#{model.class.to_s.underscore}-#{secure_token}.#{file.extension.downcase}"
else
filename = "logo-#{secure_token}.#{file.extension.downcase}"
if file.present?
if original_filename.present? || model.logo_secure_token
if Flipflop.remote_storage?
filename = "#{model.class.to_s.underscore}-#{secure_token}.#{file.extension.downcase}"
else
filename = "logo-#{secure_token}.#{file.extension.downcase}"
end
end
filename
end
filename
end
private