Skip to content

Commit 71aae7d

Browse files
benluddyk8s-publishing-bot
authored andcommitted
Allow decoding RFC 3339 CBOR strings to time.Time.
We had been relying on a bug in the library when it should have been rejected by default. That bug has been fixed and a new option added to opt-in to the behavior we need. Kubernetes-commit: b24defacc5c05ee1c991d4c74b6325fa3f77460f
1 parent a2d2122 commit 71aae7d

File tree

1 file changed

+4
-0
lines changed
  • pkg/runtime/serializer/cbor/internal/modes

1 file changed

+4
-0
lines changed

pkg/runtime/serializer/cbor/internal/modes/decode.go

+4
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ var Decode cbor.DecMode = func() cbor.DecMode {
8484
// When decoding an unrecognized tag to interface{}, return the decoded tag content
8585
// instead of the default, a cbor.Tag representing a (number, content) pair.
8686
UnrecognizedTagToAny: cbor.UnrecognizedTagContentToAny,
87+
88+
// For parity with JSON, strings can be decoded into time.Time if they are RFC 3339
89+
// timestamps.
90+
ByteStringToTime: cbor.ByteStringToTimeAllowed,
8791
}.DecMode()
8892
if err != nil {
8993
panic(err)

0 commit comments

Comments
 (0)