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.
This commit is contained in:
		| @@ -84,6 +84,10 @@ var Decode cbor.DecMode = func() cbor.DecMode { | ||||
| 		// When decoding an unrecognized tag to interface{}, return the decoded tag content | ||||
| 		// instead of the default, a cbor.Tag representing a (number, content) pair. | ||||
| 		UnrecognizedTagToAny: cbor.UnrecognizedTagContentToAny, | ||||
|  | ||||
| 		// For parity with JSON, strings can be decoded into time.Time if they are RFC 3339 | ||||
| 		// timestamps. | ||||
| 		ByteStringToTime: cbor.ByteStringToTimeAllowed, | ||||
| 	}.DecMode() | ||||
| 	if err != nil { | ||||
| 		panic(err) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Ben Luddy
					Ben Luddy