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
a65394f3
Commit
a65394f3
authored
Oct 15, 2016
by
Jacob Schatz
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://gitlab.com/gitlab-org/gitlab-ce
parents
6f59f73c
5cf10240
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
10 deletions
+18
-10
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+4
-0
config/routes.rb
config/routes.rb
+2
-0
lib/extracts_path.rb
lib/extracts_path.rb
+9
-8
spec/requests/git_http_spec.rb
spec/requests/git_http_spec.rb
+3
-2
No files found.
app/controllers/application_controller.rb
View file @
a65394f3
...
...
@@ -45,6 +45,10 @@ class ApplicationController < ActionController::Base
redirect_to
request
.
referer
.
present?
?
:back
:
default
,
options
end
def
not_found
render_404
end
protected
# This filter handles both private tokens and personal access tokens
...
...
config/routes.rb
View file @
a65394f3
...
...
@@ -88,4 +88,6 @@ Rails.application.routes.draw do
get
':username.keys'
=>
'profiles/keys#get_keys'
,
constraints:
{
username:
/.*/
}
root
to:
"root#index"
get
'*unmatched_route'
,
to:
'application#not_found'
end
lib/extracts_path.rb
View file @
a65394f3
...
...
@@ -113,17 +113,18 @@ module ExtractsPath
@id
=
get_id
@ref
,
@path
=
extract_ref
(
@id
)
@repo
=
@project
.
repository
if
@options
[
:extended_sha1
].
blank?
@commit
=
@repo
.
commit
(
@ref
)
else
@commit
=
@repo
.
commit
(
@options
[
:extended_sha1
])
end
if
@path
.
empty?
&&
!
@commit
@id
=
@ref
=
extract_ref_without_atom
(
@id
)
if
@options
[
:extended_sha1
].
present?
@commit
=
@repo
.
commit
(
@options
[
:extended_sha1
])
else
@commit
=
@repo
.
commit
(
@ref
)
request
.
format
=
:atom
if
@commit
if
@path
.
empty?
&&
!
@commit
&&
@id
.
ends_with?
(
'.atom'
)
@id
=
@ref
=
extract_ref_without_atom
(
@id
)
@commit
=
@repo
.
commit
(
@ref
)
request
.
format
=
:atom
if
@commit
end
end
raise
InvalidPathError
unless
@commit
...
...
spec/requests/git_http_spec.rb
View file @
a65394f3
...
...
@@ -412,9 +412,10 @@ describe 'Git HTTP requests', lib: true do
context
"when the params are anything else"
do
let
(
:params
)
{
{
service:
'git-implode-pack'
}
}
before
{
get
path
,
params
}
it
"
fails to find a rout
e"
do
expect
{
get
(
path
,
params
)
}.
to
raise_error
(
ActionController
::
RoutingError
)
it
"
redirects to the sign-in pag
e"
do
expect
(
response
).
to
redirect_to
(
new_user_session_path
)
end
end
end
...
...
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