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:
|
||||
return DumpBytesToString(t), nil
|
||||
case string:
|
||||
for i, c := range t {
|
||||
if c == 0 {
|
||||
t = t[:i]
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if isPrintableText(t) == false {
|
||||
phrase = fmt.Sprintf("string with binary data (%d bytes)", len(t))
|
||||
return phrase, nil
|
||||
|
|
Loading…
Reference in New Issue