Update file_info.go (fix errcheck issue) (#28966)
Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
e7e1d7d7ce
Коммит
45235a0ef6
@@ -92,7 +92,6 @@ issues:
|
|||||||
channels/app/export_test.go|\
|
channels/app/export_test.go|\
|
||||||
channels/app/file.go|\
|
channels/app/file.go|\
|
||||||
channels/app/file_bench_test.go|\
|
channels/app/file_bench_test.go|\
|
||||||
channels/app/file_info.go|\
|
|
||||||
channels/app/file_test.go|\
|
channels/app/file_test.go|\
|
||||||
channels/app/helper_test.go|\
|
channels/app/helper_test.go|\
|
||||||
channels/app/import_functions.go|\
|
channels/app/import_functions.go|\
|
||||||
|
|||||||
@@ -40,7 +40,9 @@ func getInfoForBytes(name string, data io.ReadSeeker, size int) (*model.FileInfo
|
|||||||
|
|
||||||
if info.MimeType == "image/gif" {
|
if info.MimeType == "image/gif" {
|
||||||
// Just show the gif itself instead of a preview image for animated gifs
|
// 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)
|
frameCount, err := imgutils.CountGIFFrames(data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Still return the rest of the info even though it doesn't appear to be an actual gif
|
// Still return the rest of the info even though it doesn't appear to be an actual gif
|
||||||
|
|||||||
@@ -5162,6 +5162,10 @@
|
|||||||
"id": "app.file_info.save.app_error",
|
"id": "app.file_info.save.app_error",
|
||||||
"translation": "Unable to save the file info."
|
"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",
|
"id": "app.file_info.set_searchable_content.app_error",
|
||||||
"translation": "Unable to set the searchable content of the file."
|
"translation": "Unable to set the searchable content of the file."
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user