Skip to content

Commit

Permalink
server: fix not delete tmp file when upload package (#2021)
Browse files Browse the repository at this point in the history
  • Loading branch information
nexustar authored Sep 1, 2022
1 parent ce0ada3 commit 42b07cb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 1 addition & 5 deletions server/handler/tarball.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,13 @@ func (h *tarballUploader) upload(r *http.Request) (*simpleResponse, statusError)
sid := mux.Vars(r)["sid"]
logprinter.Infof("Uploading tarball, sid: %s", sid)

if err := r.ParseMultipartForm(MaxMemory); err != nil {
// TODO: log error here
return nil, ErrorInvalidTarball
}

file, handler, err := r.FormFile("file")
if err != nil {
// TODO: log error here
return nil, ErrorInvalidTarball
}
defer file.Close()
defer r.MultipartForm.RemoveAll()

if err := h.sm.Write(sid, handler.Filename, file); err != nil {
logprinter.Errorf("Error to write tarball: %s", err.Error())
Expand Down
3 changes: 3 additions & 0 deletions tools/check/golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ linters-settings:
govet:
enable:
- nilness
errcheck:
exclude-functions:
- (*mime/multipart.Form).RemoveAll

linters:
disable-all: true
Expand Down

0 comments on commit 42b07cb

Please sign in to comment.