коммит произвёл
GitHub
родитель
1fc8a2ea20
Коммит
5aba3bb9e2
13
app/file.go
13
app/file.go
@@ -11,7 +11,6 @@ import (
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"image"
|
||||
"image/gif"
|
||||
"io"
|
||||
"mime/multipart"
|
||||
"net/http"
|
||||
@@ -830,13 +829,11 @@ func (t *UploadFileTask) preprocessImage() *model.AppError {
|
||||
// For animated GIFs disable the preview; since we have to Decode gifs
|
||||
// anyway, cache the decoded image for later.
|
||||
if t.fileinfo.MimeType == "image/gif" {
|
||||
gifConfig, err := gif.DecodeAll(io.MultiReader(bytes.NewReader(t.buf.Bytes()), t.teeInput))
|
||||
if err == nil {
|
||||
if len(gifConfig.Image) > 0 {
|
||||
t.fileinfo.HasPreviewImage = false
|
||||
t.decoded = gifConfig.Image[0]
|
||||
t.imageType = "gif"
|
||||
}
|
||||
image, format, err := t.imgDecoder.Decode(io.MultiReader(bytes.NewReader(t.buf.Bytes()), t.teeInput))
|
||||
if err == nil && image != nil {
|
||||
t.fileinfo.HasPreviewImage = false
|
||||
t.decoded = image
|
||||
t.imageType = format
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user