mirror of https://github.com/dsoprea/go-exif.git
type: Fixed FromString encoding for ASCII.
- We were appending a newline rather than NUL.pull/3/head
parent
d79470a4f4
commit
f998692895
2
type.go
2
type.go
|
@ -757,7 +757,7 @@ func (tt TagType) FromString(valueString string) (value interface{}, err error)
|
|||
if tt.tagType == TypeByte {
|
||||
return []byte(valueString), nil
|
||||
} else if tt.tagType == TypeAscii {
|
||||
return fmt.Sprintf("%s\n", valueString), nil
|
||||
return fmt.Sprintf("%s\000", valueString), nil
|
||||
} else if tt.tagType == TypeShort {
|
||||
n, err := strconv.ParseUint(valueString, 10, 16)
|
||||
log.PanicIf(err)
|
||||
|
|
|
@ -215,7 +215,7 @@ func TestTagType_FromString_Ascii(t *testing.T) {
|
|||
value, err := tt.FromString("abc")
|
||||
log.PanicIf(err)
|
||||
|
||||
if reflect.DeepEqual(value, "abc\n") != true {
|
||||
if reflect.DeepEqual(value, "abc\000") != true {
|
||||
t.Fatalf("ASCII value not correct: [%s]", value)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue