Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
eefbe9be
Commit
eefbe9be
authored
Nov 30, 2018
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable format determination based on path extension
parent
31a4b268
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
0 deletions
+24
-0
config/initializers/action_dispatch_http_mime_negotiation.rb
config/initializers/action_dispatch_http_mime_negotiation.rb
+19
-0
spec/controllers/projects/blob_controller_spec.rb
spec/controllers/projects/blob_controller_spec.rb
+5
-0
No files found.
config/initializers/action_dispatch_http_mime_negotiation.rb
0 → 100644
View file @
eefbe9be
# 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
spec/controllers/projects/blob_controller_spec.rb
View file @
eefbe9be
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment