mirror of https://github.com/dsoprea/go-exif.git
common/type.go: Truncate ASCII strings at the first NUL
This can prevent the string from being classified as "binary" and its value being suppressed in output.pull/56/head
parent
52fa399645
commit
443fda923a
|
@ -186,6 +186,13 @@ func FormatFromType(value interface{}, justFirst bool) (phrase string, err error
|
||||||
case []byte:
|
case []byte:
|
||||||
return DumpBytesToString(t), nil
|
return DumpBytesToString(t), nil
|
||||||
case string:
|
case string:
|
||||||
|
for i, c := range t {
|
||||||
|
if c == 0 {
|
||||||
|
t = t[:i]
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if isPrintableText(t) == false {
|
if isPrintableText(t) == false {
|
||||||
phrase = fmt.Sprintf("string with binary data (%d bytes)", len(t))
|
phrase = fmt.Sprintf("string with binary data (%d bytes)", len(t))
|
||||||
return phrase, nil
|
return phrase, nil
|
||||||
|
|
Loading…
Reference in New Issue