summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2018-11-30 12:50:25 +0100
committerDouwe Maan <douwe@selenight.nl>2018-12-03 12:29:02 +0100
commiteefbe9be06d88a5f9e73882c89cf5973978e167b (patch)
tree41f37aa99d916c7347550df44e54f2c3a3b10e5f /config
parent31a4b268bb9dc9868a7f615d9ca6c3dc7699ab28 (diff)
downloadgitlab-ce-eefbe9be06d88a5f9e73882c89cf5973978e167b.tar.gz
Disable format determination based on path extension
Diffstat (limited to 'config')
-rw-r--r--config/initializers/action_dispatch_http_mime_negotiation.rb19
1 files changed, 19 insertions, 0 deletions
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