mirror of
https://github.com/dsoprea/go-exif.git
synced 2025-05-31 11:41:57 +00:00
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.
This commit is contained in:
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…
x
Reference in New Issue
Block a user