[MM-38375] Fix processing bulk import with attachments (#18352)

* Fix improper attachments in replies

* Fix import data path

* Improve errors

* Fix importing attachments directly from zip file

* Add some test cases to cover error paths
Этот коммит содержится в:
Claudio Costa
2021-09-21 17:39:52 +02:00
коммит произвёл GitHub
родитель c4a25ff339
Коммит 0c84885132
10 изменённых файлов: 264 добавлений и 58 удалений

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

@@ -4,6 +4,7 @@
package imaging
import (
"fmt"
"image"
"io"
@@ -59,17 +60,17 @@ func MakeImageUpright(img image.Image, orientation int) image.Image {
func GetImageOrientation(input io.Reader) (int, error) {
exifData, err := exif.Decode(input)
if err != nil {
return Upright, err
return Upright, fmt.Errorf("failed to decode exif data: %w", err)
}
tag, err := exifData.Get("Orientation")
if err != nil {
return Upright, err
return Upright, fmt.Errorf("failed to get orientation field from exif data: %w", err)
}
orientation, err := tag.Int(0)
if err != nil {
return Upright, err
return Upright, fmt.Errorf("failed to get value from exif tag: %w", err)
}
return orientation, nil