Skip to content
This repository has been archived by the owner on Apr 7, 2019. It is now read-only.

Commit

Permalink
Files issue writing zip files
Browse files Browse the repository at this point in the history
  • Loading branch information
justinloyola committed Dec 12, 2016
1 parent a5e7461 commit 995b98a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions master/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,17 @@ func (s *UploadHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return
}

dst, err := os.OpenFile(dstPath, os.O_CREATE|os.O_TRUNC, fs.FilePerm)
dst, err := os.OpenFile(dstPath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, fs.FilePerm)
if err != nil {
log.Println("Upload file open operation failed:", err)
http.Error(w, fmt.Sprintf("Error writing uploaded file to disk: %s", err), http.StatusInternalServerError)
return
}
defer dst.Close()
io.Copy(dst, src)
if _, err := io.Copy(dst, src); err != nil {
log.Println("Error writing to destination:", err)
http.Error(w, fmt.Sprintf("Error writing zip file: %s", err), http.StatusInternalServerError)
}

switch typ {
case fs.KindEngine:
Expand Down

0 comments on commit 995b98a

Please sign in to comment.