Skip to content

Commit

Permalink
Update file_info.go (fix errcheck issue) (mattermost#28966)
Browse files Browse the repository at this point in the history
Co-authored-by: Ben Schumacher <[email protected]>
  • Loading branch information
TheInvincibleRalph and hanzei authored Nov 14, 2024
1 parent e7e1d7d commit 45235a0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 0 additions & 1 deletion server/.golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ issues:
channels/app/export_test.go|\
channels/app/file.go|\
channels/app/file_bench_test.go|\
channels/app/file_info.go|\
channels/app/file_test.go|\
channels/app/helper_test.go|\
channels/app/import_functions.go|\
Expand Down
4 changes: 3 additions & 1 deletion server/channels/app/file_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ func getInfoForBytes(name string, data io.ReadSeeker, size int) (*model.FileInfo

if info.MimeType == "image/gif" {
// Just show the gif itself instead of a preview image for animated gifs
data.Seek(0, io.SeekStart)
if _, err := data.Seek(0, io.SeekStart); err != nil {
return info, model.NewAppError("getInfoForBytes", "app.file_info.seek.gif.app_error", nil, "", http.StatusBadRequest).Wrap(err)
}
frameCount, err := imgutils.CountGIFFrames(data)
if err != nil {
// Still return the rest of the info even though it doesn't appear to be an actual gif
Expand Down
4 changes: 4 additions & 0 deletions server/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -5162,6 +5162,10 @@
"id": "app.file_info.save.app_error",
"translation": "Unable to save the file info."
},
{
"id": "app.file_info.seek.gif.app_error",
"translation": "Unable to seek to the beginning of the GIF data."
},
{
"id": "app.file_info.set_searchable_content.app_error",
"translation": "Unable to set the searchable content of the file."
Expand Down

0 comments on commit 45235a0

Please sign in to comment.