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