Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-workhorse
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
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-workhorse
Commits
ad2b32f0
Commit
ad2b32f0
authored
Dec 04, 2015
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
d33010bb
Pipeline
#141
failed with stage
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
5 deletions
+14
-5
blob.go
blob.go
+14
-5
No files found.
blob.go
View file @
ad2b32f0
...
...
@@ -14,6 +14,7 @@ import (
"log"
"net/http"
"net/http/httptest"
"net/url"
"regexp"
"strings"
"sync"
...
...
@@ -220,17 +221,25 @@ var rawRe = regexp.MustCompile(`/raw/`)
func
handleGetBlobRaw
(
w
http
.
ResponseWriter
,
r
*
gitRequest
)
{
// Extract project & refpath
// <project>/raw/branch/file -> <project>, branch/file
u
rl
:=
r
.
Request
.
URL
rawLoc
:=
rawRe
.
FindStringIndex
(
u
rl
.
Path
)
u
:=
r
.
Request
.
URL
// XXX naming
rawLoc
:=
rawRe
.
FindStringIndex
(
u
.
Path
)
if
rawLoc
==
nil
{
fail500
(
w
,
"extract project name"
,
nil
)
// XXX err=nil
return
}
project
:=
url
.
Path
[
:
rawLoc
[
0
]]
refpath
:=
url
.
Path
[
rawLoc
[
1
]
:
]
project
:=
u
.
Path
[
:
rawLoc
[
0
]]
refpath
:=
u
.
Path
[
rawLoc
[
1
]
:
]
// Extract only tokens from query
query
:=
url
.
Values
{}
for
k
,
v
:=
range
u
.
Query
()
{
if
strings
.
HasSuffix
(
k
,
"_token"
)
{
query
[
k
]
=
v
}
}
// Query download access auth for this project
authReply
:=
verifyDownloadAccess
(
r
.
u
,
project
,
url
.
RawQuery
)
authReply
:=
verifyDownloadAccess
(
r
.
u
,
project
,
query
.
Encode
()
)
if
authReply
.
RepoPath
==
""
{
// access denied - copy auth reply to client in full -
// there are HTTP code and other headers / body relevant for
...
...
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