Correctly report errors when uploading files

This commit is contained in:
Dane Everitt 2020-11-01 16:33:02 -08:00
parent 05cfb59e18
commit 384b9a3c28
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53

View File

@ -397,14 +397,14 @@ func postServerUploadFiles(c *gin.Context) {
for _, header := range headers {
p, err := s.Filesystem().SafePath(filepath.Join(directory, header.Filename))
if err != nil {
c.AbortWithError(http.StatusInternalServerError, err)
TrackedServerError(err, s).AbortFilesystemError(c)
return
}
// We run this in a different method so I can use defer without any of
// the consequences caused by calling it in a loop.
if err := handleFileUpload(p, s, header); err != nil {
c.AbortWithError(http.StatusInternalServerError, err)
TrackedServerError(err, s).AbortFilesystemError(c)
return
}
}