[MM-8421] Fix tiff preview - backend (#10170)

Этот коммит содержится в:
Angela Chang
2019-02-21 00:06:59 -08:00
коммит произвёл Hanzei
родитель 26d3362eca
Коммит 1018ead619
6 изменённых файлов: 18 добавлений и 5 удалений

Просмотреть файл

@@ -42,6 +42,7 @@ var MEDIA_CONTENT_TYPES = [...]string{
"image/png",
"image/bmp",
"image/gif",
"image/tiff",
"video/avi",
"video/mpeg",
"video/mp4",

Просмотреть файл

@@ -346,14 +346,14 @@ func TestUploadFiles(t *testing.T) {
// Upload a bunch of files, mixed images and non-images
{
title: "Happy",
names: []string{"test.png", "testgif.gif", "testplugin.tar.gz", "test-search.md"},
names: []string{"test.png", "testgif.gif", "testplugin.tar.gz", "test-search.md", "test.tiff"},
expectedCreatorId: th.BasicUser.Id,
},
// Upload a bunch of files, with clientIds
{
title: "Happy client_ids",
names: []string{"test.png", "testgif.gif", "testplugin.tar.gz", "test-search.md"},
clientIds: []string{"1", "2", "3", "4"},
names: []string{"test.png", "testgif.gif", "testplugin.tar.gz", "test-search.md", "test.tiff"},
clientIds: []string{"1", "2", "3", "4", "5"},
expectedCreatorId: th.BasicUser.Id,
},
// Upload a bunch of images. testgif.gif is an animated GIF,
@@ -478,6 +478,18 @@ func TestUploadFiles(t *testing.T) {
expectedImageHasPreview: []bool{true},
expectedCreatorId: th.BasicUser.Id,
},
// TIFF preview test
{
title: "Happy image thumbnail/preview 9",
names: []string{"test.tiff"},
expectedImageThumbnailNames: []string{"test_expected_thumb.tiff"},
expectedImagePreviewNames: []string{"test_expected_preview.tiff"},
expectImage: true,
expectedImageWidths: []int{701},
expectedImageHeights: []int{701},
expectedImageHasPreview: []bool{true},
expectedCreatorId: th.BasicUser.Id,
},
{
title: "Happy admin",
client: th.SystemAdminClient,

Просмотреть файл

@@ -13,8 +13,8 @@ const (
)
var (
IMAGE_EXTENSIONS = [5]string{".jpg", ".jpeg", ".gif", ".bmp", ".png"}
IMAGE_MIME_TYPES = map[string]string{".jpg": "image/jpeg", ".jpeg": "image/jpeg", ".gif": "image/gif", ".bmp": "image/bmp", ".png": "image/png", ".tiff": "image/tiff"}
IMAGE_EXTENSIONS = [7]string{".jpg", ".jpeg", ".gif", ".bmp", ".png", ".tiff", "tif"}
IMAGE_MIME_TYPES = map[string]string{".jpg": "image/jpeg", ".jpeg": "image/jpeg", ".gif": "image/gif", ".bmp": "image/bmp", ".png": "image/png", ".tiff": "image/tiff", ".tif": "image/tif"}
)
type FileUploadResponse struct {

Двоичные данные
tests/test.tiff Обычный файл

Двоичный файл не отображается.

Двоичные данные
tests/test_expected_preview.tiff Обычный файл

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 24 KiB

Двоичные данные
tests/test_expected_thumb.tiff Обычный файл

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 3.5 KiB