From eefbe9be06d88a5f9e73882c89cf5973978e167b Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Fri, 30 Nov 2018 12:50:25 +0100 Subject: Disable format determination based on path extension --- .../action_dispatch_http_mime_negotiation.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 config/initializers/action_dispatch_http_mime_negotiation.rb (limited to 'config') diff --git a/config/initializers/action_dispatch_http_mime_negotiation.rb b/config/initializers/action_dispatch_http_mime_negotiation.rb new file mode 100644 index 00000000000..bdf5b0babfb --- /dev/null +++ b/config/initializers/action_dispatch_http_mime_negotiation.rb @@ -0,0 +1,19 @@ +# 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 -- cgit v1.2.3