From a62076c34beff95a01816440a84d28bced64c8da Mon Sep 17 00:00:00 2001 From: Guillaume Lazzara Date: Tue, 24 May 2016 17:34:52 +0200 Subject: [PATCH] Use original file extension for uploaded files --- app/uploaders/cerfa_uploader.rb | 4 ++-- app/uploaders/piece_justificative_uploader.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/uploaders/cerfa_uploader.rb b/app/uploaders/cerfa_uploader.rb index 8040d94ff..8b966aa4a 100644 --- a/app/uploaders/cerfa_uploader.rb +++ b/app/uploaders/cerfa_uploader.rb @@ -31,9 +31,9 @@ class CerfaUploader < CarrierWave::Uploader::Base def filename if original_filename.present? || model.content_secure_token if Features.remote_storage - filename = "#{model.class.to_s.underscore}-#{secure_token}.pdf" + filename = "#{model.class.to_s.underscore}-#{secure_token}.#{file.extension.downcase}" else - filename = "#{model.class.to_s.underscore}.pdf" + filename = "#{model.class.to_s.underscore}.#{file.extension.downcase}" end end filename diff --git a/app/uploaders/piece_justificative_uploader.rb b/app/uploaders/piece_justificative_uploader.rb index 3fbc4b32f..5337f87c3 100644 --- a/app/uploaders/piece_justificative_uploader.rb +++ b/app/uploaders/piece_justificative_uploader.rb @@ -31,9 +31,9 @@ class PieceJustificativeUploader < CarrierWave::Uploader::Base def filename if original_filename.present? || model.content_secure_token if Features.remote_storage - filename = "#{model.class.to_s.underscore}-#{secure_token}.pdf" + filename = "#{model.class.to_s.underscore}-#{secure_token}.#{file.extension.downcase}" else original_filename - filename = "#{model.class.to_s.underscore}.pdf" + filename = "#{model.class.to_s.underscore}.#{file.extension.downcase}" end end filename