diff --git a/resources/images/exif/exif.go b/resources/images/exif/exif.go index 929c25bd378..0985ec5fec7 100644 --- a/resources/images/exif/exif.go +++ b/resources/images/exif/exif.go @@ -14,9 +14,7 @@ package exif import ( - "fmt" "io" - "io/ioutil" "math/big" "regexp" "strings" @@ -26,7 +24,6 @@ import ( _exif "github.com/dsoprea/go-exif/v3" exifcommon "github.com/dsoprea/go-exif/v3/common" - png "github.com/dsoprea/go-png-image-structure" ) const ( @@ -110,17 +107,9 @@ func NewDecoder(options ...func(*Decoder) error) (*Decoder, error) { } func (d *Decoder) Decode(r io.Reader) (*Exif, error) { - rawBytes, err := ioutil.ReadAll(r) - if err != nil { - return nil, err - } - rawExif, err := _exif.SearchAndExtractExif(rawBytes) + rawExif, err := _exif.SearchAndExtractExifWithReader(r) if err != nil { - parsed := png.NewPngMediaParser() - if parsed.LooksLikeFormat(rawBytes) { - return nil, fmt.Errorf("type not supported") - } // No Exif data return nil, nil } diff --git a/resources/images/exif/exif_test.go b/resources/images/exif/exif_test.go index 555d28c3045..9f649e9f8f1 100644 --- a/resources/images/exif/exif_test.go +++ b/resources/images/exif/exif_test.go @@ -143,8 +143,9 @@ func TestExifPNG(t *testing.T) { d, err := NewDecoder() c.Assert(err, qt.IsNil) - _, err = d.Decode(f) - c.Assert(err, qt.Not(qt.IsNil)) + x, err := d.Decode(f) + c.Assert(err, qt.IsNil) + c.Assert(x, qt.IsNil) } func TestIssue8079(t *testing.T) {