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
4fe063cf
Commit
4fe063cf
authored
Jan 25, 2016
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve error messages
parent
1bb40cdf
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
13 deletions
+17
-13
internal/artifacts/artifact_download.go
internal/artifacts/artifact_download.go
+1
-1
internal/git/archive.go
internal/git/archive.go
+1
-1
internal/git/git-http.go
internal/git/git-http.go
+2
-2
internal/lfs/lfs.go
internal/lfs/lfs.go
+1
-1
internal/upload/uploads.go
internal/upload/uploads.go
+12
-8
No files found.
internal/artifacts/artifact_download.go
View file @
4fe063cf
...
@@ -61,7 +61,7 @@ func unpackFileFromZip(archiveFileName, encodedFilename string, headers http.Hea
...
@@ -61,7 +61,7 @@ func unpackFileFromZip(archiveFileName, encodedFilename string, headers http.Hea
headers
.
Set
(
"Content-Disposition"
,
"attachment; filename=
\"
"
+
escapeQuotes
(
basename
)
+
"
\"
"
)
headers
.
Set
(
"Content-Disposition"
,
"attachment; filename=
\"
"
+
escapeQuotes
(
basename
)
+
"
\"
"
)
// Copy file body to client
// Copy file body to client
if
_
,
err
:=
io
.
Copy
(
output
,
reader
);
err
!=
nil
{
if
_
,
err
:=
io
.
Copy
(
output
,
reader
);
err
!=
nil
{
return
fmt
.
Errorf
(
"copy
%v stdout
: %v"
,
catFile
.
Args
,
err
)
return
fmt
.
Errorf
(
"copy
stdout of %v
: %v"
,
catFile
.
Args
,
err
)
}
}
return
waitCatFile
(
catFile
)
return
waitCatFile
(
catFile
)
...
...
internal/git/archive.go
View file @
4fe063cf
...
@@ -111,7 +111,7 @@ func handleGetArchive(w http.ResponseWriter, r *http.Request, a *api.Response) {
...
@@ -111,7 +111,7 @@ func handleGetArchive(w http.ResponseWriter, r *http.Request, a *api.Response) {
setArchiveHeaders
(
w
,
format
,
archiveFilename
)
setArchiveHeaders
(
w
,
format
,
archiveFilename
)
w
.
WriteHeader
(
200
)
// Don't bother with HTTP 500 from this point on, just return
w
.
WriteHeader
(
200
)
// Don't bother with HTTP 500 from this point on, just return
if
_
,
err
:=
io
.
Copy
(
w
,
archiveReader
);
err
!=
nil
{
if
_
,
err
:=
io
.
Copy
(
w
,
archiveReader
);
err
!=
nil
{
helper
.
LogError
(
fmt
.
Errorf
(
"handleGetArchive:
read
: %v"
,
err
))
helper
.
LogError
(
fmt
.
Errorf
(
"handleGetArchive:
copy 'git archive' output
: %v"
,
err
))
return
return
}
}
if
err
:=
archiveCmd
.
Wait
();
err
!=
nil
{
if
err
:=
archiveCmd
.
Wait
();
err
!=
nil
{
...
...
internal/git/git-http.go
View file @
4fe063cf
...
@@ -87,7 +87,7 @@ func handleGetInfoRefs(w http.ResponseWriter, r *http.Request, a *api.Response)
...
@@ -87,7 +87,7 @@ func handleGetInfoRefs(w http.ResponseWriter, r *http.Request, a *api.Response)
return
return
}
}
if
_
,
err
:=
io
.
Copy
(
w
,
stdout
);
err
!=
nil
{
if
_
,
err
:=
io
.
Copy
(
w
,
stdout
);
err
!=
nil
{
helper
.
LogError
(
fmt
.
Errorf
(
"handleGetInfoRefs:
read from
%v: %v"
,
cmd
.
Args
,
err
))
helper
.
LogError
(
fmt
.
Errorf
(
"handleGetInfoRefs:
copy output of
%v: %v"
,
cmd
.
Args
,
err
))
return
return
}
}
if
err
:=
cmd
.
Wait
();
err
!=
nil
{
if
err
:=
cmd
.
Wait
();
err
!=
nil
{
...
@@ -146,7 +146,7 @@ func handlePostRPC(w http.ResponseWriter, r *http.Request, a *api.Response) {
...
@@ -146,7 +146,7 @@ func handlePostRPC(w http.ResponseWriter, r *http.Request, a *api.Response) {
// This io.Copy may take a long time, both for Git push and pull.
// This io.Copy may take a long time, both for Git push and pull.
if
_
,
err
:=
io
.
Copy
(
w
,
stdout
);
err
!=
nil
{
if
_
,
err
:=
io
.
Copy
(
w
,
stdout
);
err
!=
nil
{
helper
.
LogError
(
fmt
.
Errorf
(
"handlePostRPC
read from
%v: %v"
,
cmd
.
Args
,
err
))
helper
.
LogError
(
fmt
.
Errorf
(
"handlePostRPC
copy output of
%v: %v"
,
cmd
.
Args
,
err
))
return
return
}
}
if
err
:=
cmd
.
Wait
();
err
!=
nil
{
if
err
:=
cmd
.
Wait
();
err
!=
nil
{
...
...
internal/lfs/lfs.go
View file @
4fe063cf
...
@@ -61,7 +61,7 @@ func handleStoreLfsObject(h http.Handler) api.HandleFunc {
...
@@ -61,7 +61,7 @@ func handleStoreLfsObject(h http.Handler) api.HandleFunc {
written
,
err
:=
io
.
Copy
(
hw
,
r
.
Body
)
written
,
err
:=
io
.
Copy
(
hw
,
r
.
Body
)
if
err
!=
nil
{
if
err
!=
nil
{
helper
.
Fail500
(
w
,
fmt
.
Errorf
(
"handleStoreLfsObject:
write
tempfile: %v"
,
err
))
helper
.
Fail500
(
w
,
fmt
.
Errorf
(
"handleStoreLfsObject:
copy body to
tempfile: %v"
,
err
))
return
return
}
}
file
.
Close
()
file
.
Close
()
...
...
internal/upload/uploads.go
View file @
4fe063cf
...
@@ -20,7 +20,11 @@ func rewriteFormFilesFromMultipart(r *http.Request, writer *multipart.Writer, te
...
@@ -20,7 +20,11 @@ func rewriteFormFilesFromMultipart(r *http.Request, writer *multipart.Writer, te
// Create multipart reader
// Create multipart reader
reader
,
err
:=
r
.
MultipartReader
()
reader
,
err
:=
r
.
MultipartReader
()
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
if
err
==
http
.
ErrNotMultipart
{
// We want to be able to recognize http.ErrNotMultipart elsewhere so no fmt.Errorf
return
nil
,
http
.
ErrNotMultipart
}
return
nil
,
fmt
.
Errorf
(
"get multipart reader: %v"
,
err
)
}
}
var
files
[]
string
var
files
[]
string
...
@@ -53,13 +57,13 @@ func rewriteFormFilesFromMultipart(r *http.Request, writer *multipart.Writer, te
...
@@ -53,13 +57,13 @@ func rewriteFormFilesFromMultipart(r *http.Request, writer *multipart.Writer, te
if
filename
:=
p
.
FileName
();
filename
!=
""
{
if
filename
:=
p
.
FileName
();
filename
!=
""
{
// Create temporary directory where the uploaded file will be stored
// Create temporary directory where the uploaded file will be stored
if
err
:=
os
.
MkdirAll
(
tempPath
,
0700
);
err
!=
nil
{
if
err
:=
os
.
MkdirAll
(
tempPath
,
0700
);
err
!=
nil
{
return
cleanup
,
err
return
cleanup
,
fmt
.
Errorf
(
"mkdir for tempfile: %v"
,
err
)
}
}
// Create temporary file in path returned by Authorization filter
// Create temporary file in path returned by Authorization filter
file
,
err
:=
ioutil
.
TempFile
(
tempPath
,
"upload_"
)
file
,
err
:=
ioutil
.
TempFile
(
tempPath
,
"upload_"
)
if
err
!=
nil
{
if
err
!=
nil
{
return
cleanup
,
err
return
cleanup
,
fmt
.
Errorf
(
"create tempfile: %v"
,
err
)
}
}
defer
file
.
Close
()
defer
file
.
Close
()
...
@@ -70,7 +74,7 @@ func rewriteFormFilesFromMultipart(r *http.Request, writer *multipart.Writer, te
...
@@ -70,7 +74,7 @@ func rewriteFormFilesFromMultipart(r *http.Request, writer *multipart.Writer, te
_
,
err
=
io
.
Copy
(
file
,
p
)
_
,
err
=
io
.
Copy
(
file
,
p
)
if
err
!=
nil
{
if
err
!=
nil
{
return
cleanup
,
err
return
cleanup
,
fmt
.
Errorf
(
"copy from multipart to tempfile: %v"
,
err
)
}
}
file
.
Close
()
file
.
Close
()
...
@@ -81,16 +85,16 @@ func rewriteFormFilesFromMultipart(r *http.Request, writer *multipart.Writer, te
...
@@ -81,16 +85,16 @@ func rewriteFormFilesFromMultipart(r *http.Request, writer *multipart.Writer, te
}
else
{
}
else
{
np
,
err
:=
writer
.
CreatePart
(
p
.
Header
)
np
,
err
:=
writer
.
CreatePart
(
p
.
Header
)
if
err
!=
nil
{
if
err
!=
nil
{
return
cleanup
,
err
return
cleanup
,
fmt
.
Errorf
(
"create multipart field: %v"
,
err
)
}
}
_
,
err
=
io
.
Copy
(
np
,
p
)
_
,
err
=
io
.
Copy
(
np
,
p
)
if
err
!=
nil
{
if
err
!=
nil
{
return
cleanup
,
err
return
cleanup
,
fmt
.
Errorf
(
"duplicate multipart field: %v"
,
err
)
}
}
if
err
:=
filter
.
ProcessField
(
name
,
writer
);
err
!=
nil
{
if
err
:=
filter
.
ProcessField
(
name
,
writer
);
err
!=
nil
{
return
cleanup
,
err
return
cleanup
,
fmt
.
Errorf
(
"process multipart field: %v"
,
err
)
}
}
}
}
}
}
...
@@ -99,7 +103,7 @@ func rewriteFormFilesFromMultipart(r *http.Request, writer *multipart.Writer, te
...
@@ -99,7 +103,7 @@ func rewriteFormFilesFromMultipart(r *http.Request, writer *multipart.Writer, te
func
HandleFileUploads
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
,
h
http
.
Handler
,
tempPath
string
,
filter
MultipartFormProcessor
)
{
func
HandleFileUploads
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
,
h
http
.
Handler
,
tempPath
string
,
filter
MultipartFormProcessor
)
{
if
tempPath
==
""
{
if
tempPath
==
""
{
helper
.
Fail500
(
w
,
fmt
.
Errorf
(
"handleFileUploads: temp
orary path not defined
"
))
helper
.
Fail500
(
w
,
fmt
.
Errorf
(
"handleFileUploads: temp
Path empty
"
))
return
return
}
}
...
...
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