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
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
iv
gitlab-workhorse
Commits
9b99c614
Commit
9b99c614
authored
Nov 06, 2015
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reuse xsendfile to download the object.
parent
03b7df08
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
30 deletions
+1
-30
lfs.go
lfs.go
+0
-29
upstream.go
upstream.go
+1
-1
No files found.
lfs.go
View file @
9b99c614
...
@@ -113,35 +113,6 @@ func handleStoreLfsObject(w http.ResponseWriter, r *gitRequest, rpc string) {
...
@@ -113,35 +113,6 @@ func handleStoreLfsObject(w http.ResponseWriter, r *gitRequest, rpc string) {
}
}
func
handleRetreiveLfsObject
(
w
http
.
ResponseWriter
,
r
*
gitRequest
,
rpc
string
)
{
log
.
Printf
(
"I should download %s"
,
r
)
urlPath
:=
r
.
URL
.
Path
regExp
:=
regexp
.
MustCompile
(
`([0-9a-f]{64})\z`
)
oid
:=
regExp
.
FindString
(
urlPath
)
if
len
(
oid
)
==
0
{
log
.
Printf
(
"Found no object for download: %s"
,
urlPath
)
return
}
log
.
Printf
(
"Found oid: %s"
,
oid
)
path
:=
filepath
.
Join
(
r
.
StoreLFSPath
,
transformKey
(
oid
))
content
,
err
:=
os
.
Open
(
path
)
if
err
!=
nil
{
fail500
(
w
,
"Cannot get file: "
,
err
)
return
}
defer
content
.
Close
()
io
.
Copy
(
w
,
content
)
log
.
Printf
(
"Sent the LFS object to client, oid: %s"
,
oid
)
return
}
func
transformKey
(
key
string
)
string
{
func
transformKey
(
key
string
)
string
{
if
len
(
key
)
<
5
{
if
len
(
key
)
<
5
{
return
key
return
key
...
...
upstream.go
View file @
9b99c614
...
@@ -65,7 +65,7 @@ var gitServices = [...]gitService{
...
@@ -65,7 +65,7 @@ var gitServices = [...]gitService{
gitService
{
"GET"
,
regexp
.
MustCompile
(
`/repository/archive.tar.gz\z`
),
repoPreAuth
,
handleGetArchive
,
"tar.gz"
},
gitService
{
"GET"
,
regexp
.
MustCompile
(
`/repository/archive.tar.gz\z`
),
repoPreAuth
,
handleGetArchive
,
"tar.gz"
},
gitService
{
"GET"
,
regexp
.
MustCompile
(
`/repository/archive.tar.bz2\z`
),
repoPreAuth
,
handleGetArchive
,
"tar.bz2"
},
gitService
{
"GET"
,
regexp
.
MustCompile
(
`/repository/archive.tar.bz2\z`
),
repoPreAuth
,
handleGetArchive
,
"tar.bz2"
},
gitService
{
"PUT"
,
regexp
.
MustCompile
(
`/gitlab-lfs/objects/([0-9a-f]{64})/([0-9]+)\z`
),
repoPreAuth
,
handleStoreLfsObject
,
"lfs-object-receive"
},
gitService
{
"PUT"
,
regexp
.
MustCompile
(
`/gitlab-lfs/objects/([0-9a-f]{64})/([0-9]+)\z`
),
repoPreAuth
,
handleStoreLfsObject
,
"lfs-object-receive"
},
gitService
{
"GET"
,
regexp
.
MustCompile
(
`/gitlab-lfs/objects/([0-9a-f]{64})\z`
),
repoPreAuth
,
handleRetreiveLfsObject
,
"lfs-object-upload"
},
gitService
{
"GET"
,
regexp
.
MustCompile
(
`/gitlab-lfs/objects/([0-9a-f]{64})\z`
),
xSendFile
,
nil
,
"lfs-object-upload"
},
gitService
{
"GET"
,
regexp
.
MustCompile
(
`/uploads/`
),
xSendFile
,
nil
,
""
},
gitService
{
"GET"
,
regexp
.
MustCompile
(
`/uploads/`
),
xSendFile
,
nil
,
""
},
}
}
...
...
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