Skip to content

Commit

Permalink
Storage: returns only error and not result if one of the multipart fi…
Browse files Browse the repository at this point in the history
…les processing throws
  • Loading branch information
emmdim committed Jan 8, 2025
1 parent 82a005e commit 0906201
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions api/object_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ func (a *API) uploadImageWithFormHandler(w http.ResponseWriter, r *http.Request)
// Open the file
file, err := fileHeader.Open()
if err != nil {
ErrStorageInvalidObject.Withf("cannot open file %v", err).Write(w)
break
ErrStorageInvalidObject.Withf("cannot open file %s %v", fileHeader.Filename, err).Write(w)
return
}
defer func() {
if err := file.Close(); err != nil {
ErrStorageInvalidObject.Withf("cannot close file %v", err).Write(w)
ErrStorageInvalidObject.Withf("cannot close file %s %v", fileHeader.Filename, err).Write(w)
return
}
}()
Expand All @@ -51,8 +51,8 @@ func (a *API) uploadImageWithFormHandler(w http.ResponseWriter, r *http.Request)
filesFound = true
storedFileID, err := a.objectStorage.Put(file, fileHeader.Size, user.Email)
if err != nil {
ErrInternalStorageError.With(err.Error()).Write(w)
break
ErrInternalStorageError.Withf("%s %v", fileHeader.Filename, err).Write(w)
return
}
returnURLs = append(returnURLs, objectURL(a.serverURL, storedFileID))
}
Expand Down

0 comments on commit 0906201

Please sign in to comment.