diff --git a/master/upload.go b/master/upload.go index ee758094..79206035 100644 --- a/master/upload.go +++ b/master/upload.go @@ -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: