diff --git a/exifscrubber/exifscrubber.go b/exifscrubber/exifscrubber.go index f28683c..e3fa521 100644 --- a/exifscrubber/exifscrubber.go +++ b/exifscrubber/exifscrubber.go @@ -8,6 +8,9 @@ import ( exif "github.com/dsoprea/go-exif/v3" exifcommon "github.com/dsoprea/go-exif/v3/common" jis "github.com/dsoprea/go-jpeg-image-structure/v2" + // This is only needed for the log.Is() function to test error types. I would normally just + // reimplement this function privately but it is pulled in as an indirect dependency anyway. + exiflog "github.com/dsoprea/go-logging" pis "github.com/dsoprea/go-png-image-structure/v2" ) @@ -37,7 +40,7 @@ func (scrubber *ExifScrubber) ScrubExif(fileData []byte) ([]byte, error) { segmentList := intfc.(*jis.SegmentList) rootIfd, _, err := segmentList.Exif() if err != nil { - if err == exif.ErrNoExif { + if exiflog.Is(err, exif.ErrNoExif) { // Incoming data contained no EXIF in the first place so we can return the original return fileData, nil } @@ -71,7 +74,7 @@ func (scrubber *ExifScrubber) ScrubExif(fileData []byte) ([]byte, error) { chunks := intfc.(*pis.ChunkSlice) rootIfd, _, err := chunks.Exif() if err != nil { - if err == exif.ErrNoExif { + if exiflog.Is(err, exif.ErrNoExif) { // Incoming data contained no EXIF in the first place so we can return the original return fileData, nil } diff --git a/go.mod b/go.mod index 65013e5..5d81cf9 100644 --- a/go.mod +++ b/go.mod @@ -5,16 +5,16 @@ go 1.19 require ( github.com/dsoprea/go-exif/v3 v3.0.0-20210512043655-120bcdb2a55e github.com/dsoprea/go-jpeg-image-structure/v2 v2.0.0-20210512043942-b434301c6836 + github.com/dsoprea/go-logging v0.0.0-20200710184922-b02d349568dd github.com/dsoprea/go-png-image-structure/v2 v2.0.0-20210512210324-29b889a6093d + github.com/go-errors/errors v1.1.1 golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e ) require ( github.com/dsoprea/go-iptc v0.0.0-20200609062250-162ae6b44feb // indirect - github.com/dsoprea/go-logging v0.0.0-20200710184922-b02d349568dd // indirect github.com/dsoprea/go-photoshop-info-format v0.0.0-20200609050348-3db9b63b202c // indirect github.com/dsoprea/go-utility/v2 v2.0.0-20200717064901-2fccff4aa15e // indirect - github.com/go-errors/errors v1.1.1 // indirect github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b // indirect github.com/golang/geo v0.0.0-20200319012246-673a6f80352d // indirect golang.org/x/net v0.0.0-20200707034311-ab3426394381 // indirect