Commit eefbe9be authored by Douwe Maan's avatar Douwe Maan

Disable format determination based on path extension

parent 31a4b268
# Starting with Rails 5, Rails tries to determine the request format based on
# the extension of the full URL path if no explicit `format` param or `Accept`
# header is provided, like when simply browsing to a page in your browser.
#
# This is undesireable in GitLab, because many of our paths will end in a ref or
# blob name that can end with any extension, while these pages should still be
# presented as HTML unless otherwise specified.
# We override `format_from_path_extension` to disable this behavior.
module ActionDispatch
module Http
module MimeNegotiation
def format_from_path_extension
nil
end
end
end
end
...@@ -35,6 +35,11 @@ describe Projects::BlobController do ...@@ -35,6 +35,11 @@ describe Projects::BlobController do
let(:id) { 'binary-encoding/encoding/binary-1.bin' } let(:id) { 'binary-encoding/encoding/binary-1.bin' }
it { is_expected.to respond_with(:success) } it { is_expected.to respond_with(:success) }
end end
context "Markdown file" do
let(:id) { 'master/README.md' }
it { is_expected.to respond_with(:success) }
end
end end
context 'with file path and JSON format' do context 'with file path and JSON format' do
......
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