allow prefix 0x in byte field set

This commit is contained in:
gutmet 2020-04-27 18:00:19 +02:00
parent 69114e6782
commit 88c7d63adc

View File

@ -173,6 +173,7 @@ func (part *filePart) setHandling() {
return hex.EncodeToString(buf) return hex.EncodeToString(buf)
} }
writeTo := func(w io.Writer, bo binary.ByteOrder, s string) { writeTo := func(w io.Writer, bo binary.ByteOrder, s string) {
s = strings.TrimPrefix(s, "0x")
buf, err := hex.DecodeString(s) buf, err := hex.DecodeString(s)
optPanic("invalid string of hex values: "+s, err) optPanic("invalid string of hex values: "+s, err)
if int64(len(buf)) > bytes { if int64(len(buf)) > bytes {