[MM-29111] Fix errcheck issues in server/channels/app/upload.go (#30678)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Ben Schumacher
2025-05-07 13:40:51 +02:00
committed by GitHub
co-authored by Claude
parent bfb15ab179
commit 92011a6c75
2 changed files with 10 additions and 2 deletions
-1
View File
@@ -97,7 +97,6 @@ issues:
channels/app/platform/license.go|\
channels/app/slashcommands/command_test.go|\
channels/app/slashcommands/helper_test.go|\
channels/app/upload.go|\
channels/store/localcachelayer/channel_layer.go|\
channels/store/localcachelayer/channel_layer_test.go|\
channels/store/localcachelayer/emoji_layer.go|\
+10 -1
View File
@@ -230,7 +230,16 @@ func (a *App) UploadData(c request.CTX, us *model.UploadSession, rd io.Reader) (
return nil, err
}
if written < minFirstPartSize && written != us.FileSize {
a.RemoveFile(uploadPath)
if fileErr := a.RemoveFile(uploadPath); fileErr != nil {
c.Logger().Warn("Failed to remove initial upload chunk that was too small",
mlog.Err(fileErr),
mlog.String("upload_path", uploadPath),
mlog.String("upload_id", us.Id),
mlog.String("filename", us.Filename),
mlog.Int("chunk_size", int(written)),
mlog.Int("min_size", minFirstPartSize),
)
}
var errStr string
if err != nil {
errStr = err.Error()