Fixed golangci-lint issues: /fission/pkg (#1902)

This commit is contained in:
Gaurav Gahlot
2021-01-19 23:29:20 +05:30
committed by GitHub
parent 6dbdf4d88b
commit 695b0759e4
21 changed files with 178 additions and 66 deletions
+13 -2
View File
@@ -65,7 +65,10 @@ func getStorageLocation(config *storageConfig) (stow.Location, error) {
// Handle multipart file uploads.
func (ss *StorageService) uploadHandler(w http.ResponseWriter, r *http.Request) {
// handle upload
r.ParseMultipartForm(0)
err := r.ParseMultipartForm(0)
if err != nil {
http.Error(w, "failed to parse request", http.StatusBadRequest)
}
file, handler, err := r.FormFile("uploadfile")
if err != nil {
http.Error(w, "missing upload file", http.StatusBadRequest)
@@ -121,7 +124,15 @@ func (ss *StorageService) uploadHandler(w http.ResponseWriter, r *http.Request)
http.Error(w, "Error marshaling response", http.StatusInternalServerError)
return
}
w.Write(resp)
_, err = w.Write(resp)
if err != nil {
ss.logger.Error(
"error writing HTTP response",
zap.Error(err),
zap.String("filename", handler.Filename),
)
}
}
func (ss *StorageService) getIdFromRequest(r *http.Request) (string, error) {