mirror of https://github.com/dsoprea/go-exif.git
ifd_tag_entry.go: Bugfix for GetRawBytes() mishandling error from exifundefined.Decode()
if `Decode()` returns `exifcommon.ErrUnhandledUndefinedTypedTag` it just falls through, but should have been returning `exifundefined.ErrUnparseableValue`. - Also, `GetRawBytes()` was missing the recover clause for blanket error handler.dustin/master
parent
1a62daf305
commit
a06d9b9e40
|
@ -134,6 +134,12 @@ func (ite *IfdTagEntry) getValueOffset() uint32 {
|
|||
|
||||
// RawBytes renders a specific list of bytes from the value in this tag.
|
||||
func (ite *IfdTagEntry) GetRawBytes() (rawBytes []byte, err error) {
|
||||
defer func() {
|
||||
if state := recover(); state != nil {
|
||||
err = log.Wrap(state.(error))
|
||||
}
|
||||
}()
|
||||
|
||||
valueContext := ite.getValueContext()
|
||||
|
||||
if ite.tagType == exifcommon.TypeUndefined {
|
||||
|
@ -141,6 +147,7 @@ func (ite *IfdTagEntry) GetRawBytes() (rawBytes []byte, err error) {
|
|||
if err != nil {
|
||||
if err == exifcommon.ErrUnhandledUndefinedTypedTag {
|
||||
ite.setIsUnhandledUnknown(true)
|
||||
return nil, exifundefined.ErrUnparseableValue
|
||||
} else if err == exifundefined.ErrUnparseableValue {
|
||||
return nil, err
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue