]> Cypherpunks repositories - keks.git/commitdiff
check utf8 by default
authorRudenkoAD <rudenko.ad@phystech.edu>
Mon, 20 Jan 2025 08:30:56 +0000 (11:30 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Mon, 10 Feb 2025 15:39:44 +0000 (18:39 +0300)
go/atom-decode.go

index 7bfd0a37d5b199d73b1e8f04d6a0931ebdb43d0ce24096fc57639d2a8b552199..6fe0e54a40d628a556cb458afe012a866b4979febdf247535d4b806104e9effd 100644 (file)
@@ -60,7 +60,8 @@ func (ctx *Decoder) DecodeAtom() (t types.Type, err error) {
                ctx.types = append(ctx.types, t)
                ctx.depths = append(ctx.depths, ctx.depth)
                ctx.strs = append(ctx.strs, s)
-               if t == types.Str && ctx.opts != nil && !ctx.opts.DisableUTF8Check {
+               disabled := ctx.opts != nil && ctx.opts.DisableUTF8Check
+               if t == types.Str && !disabled {
                        if !utf8.ValidString(s) {
                                err = ErrBadUTF8
                        }