diff options
author | Jasper Maes <jaspermaes.jm@gmail.com> | 2018-06-15 19:07:47 +0300 |
---|---|---|
committer | Jasper Maes <jaspermaes.jm@gmail.com> | 2018-06-18 19:21:40 +0300 |
commit | 4f76d953ddb44babe87c74be7e88018bd2e9aaa3 (patch) | |
tree | 241e192bafb22d151228d8e1409d4e4b6d845194 /app/controllers/concerns/uploads_actions.rb | |
parent | 5297e94d3988859a0549efead33d6fab906cceca (diff) |
Rails5 fix format in uploads actions
Diffstat (limited to 'app/controllers/concerns/uploads_actions.rb')
-rw-r--r-- | app/controllers/concerns/uploads_actions.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/app/controllers/concerns/uploads_actions.rb b/app/controllers/concerns/uploads_actions.rb index 170bca8b56f..16374146ae4 100644 --- a/app/controllers/concerns/uploads_actions.rb +++ b/app/controllers/concerns/uploads_actions.rb @@ -1,9 +1,15 @@ module UploadsActions + extend ActiveSupport::Concern + include Gitlab::Utils::StrongMemoize include SendFileUpload UPLOAD_MOUNTS = %w(avatar attachment file logo header_logo favicon).freeze + included do + prepend_before_action :set_html_format, only: :show + end + def create link_to_file = UploadService.new(model, params[:file], uploader_class).execute @@ -41,6 +47,13 @@ module UploadsActions private + # Explicitly set the format. + # Otherwise rails 5 will set it from a file extension. + # See https://github.com/rails/rails/commit/84e8accd6fb83031e4c27e44925d7596655285f7#diff-2b8f2fbb113b55ca8e16001c393da8f1 + def set_html_format + request.format = :html + end + def uploader_class raise NotImplementedError end |