From c3065144f09ce1edc1ecd273bc378baec1a82be0 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Thu, 29 Nov 2018 19:59:22 -0800 Subject: [PATCH] cbor: decode undefined as null See: https://github.com/ipfs/go-ipfs/issues/5776 This won't round-trip undef, it'll just convert it to null (which is what most decoders do anyways). --- encoding/unmarshaller.go | 2 +- package.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/encoding/unmarshaller.go b/encoding/unmarshaller.go index 0ad2e39..2561dd7 100644 --- a/encoding/unmarshaller.go +++ b/encoding/unmarshaller.go @@ -26,7 +26,7 @@ type Unmarshaller struct { // NewUnmarshallerAtlased creates a new reusable unmarshaller. func NewUnmarshallerAtlased(atl atlas.Atlas) *Unmarshaller { m := new(Unmarshaller) - m.unmarshal = cbor.NewUnmarshallerAtlased(&m.reader, atl) + m.unmarshal = cbor.NewUnmarshallerAtlased(cbor.DecodeOptions{CoerceUndefToNull: true}, &m.reader, atl) return m } diff --git a/package.json b/package.json index fc0a1e7..9fc16aa 100644 --- a/package.json +++ b/package.json @@ -39,9 +39,9 @@ }, { "author": "why", - "hash": "QmfWqohMtbivn5NRJvtrLzCW3EU4QmoLvVNtmvo9vbdtVA", + "hash": "QmNScbpMAm3r2D25kmfQ43JCbQ8QCtai4V4DNz5ebuXUuZ", "name": "refmt", - "version": "1.1.2" + "version": "1.1.3" } ], "gxVersion": "0.10.0",