Commit c48e7dc2 authored by blackst0ne's avatar blackst0ne

[Rails5] Set request.format for artifacts_controller

Since Rails 5 request.format gets set by extension if it's not explicitly
set.
That means artifacts_controller#file no longer works as expected.
This commit explicitly sets request.format for artifacts_controller#file.
parent f733d4f8
......@@ -7,6 +7,7 @@ class Projects::ArtifactsController < Projects::ApplicationController
before_action :authorize_read_build!
before_action :authorize_update_build!, only: [:keep]
before_action :extract_ref_name_and_path
before_action :set_request_format, only: [:file]
before_action :validate_artifacts!
before_action :entry, only: [:file]
......@@ -101,4 +102,12 @@ class Projects::ArtifactsController < Projects::ApplicationController
render_404 unless @entry.exists?
end
def set_request_format
request.format = :html if set_request_format?
end
def set_request_format?
request.format != :json
end
end
---
title: "[Rails5] Set request.format for artifacts_controller"
merge_request: 19937
author: "@blackst0ne"
type: fixed
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment