~rockorager/go-jmap

f6efa21348b94093aa99a098686111b782908895 — Tim Culverhouse 1 year, 3 months ago 1e245f9
id: remove check for valid id

Remove check for valid jmap ID when marshalling JSON. This can cause
errors when using reference IDs ("#id")

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
1 files changed, 3 insertions(+), 3 deletions(-)

M jmap.go
M jmap.go => jmap.go +3 -3
@@ 35,9 35,9 @@ func (id ID) MarshalJSON() ([]byte, error) {
	if len(string(id)) > 255 {
		return nil, fmt.Errorf("invalid ID: too long")
	}
	if !idRegexp.MatchString(string(id)) {
		return nil, fmt.Errorf("invalid ID: invalid characters")
	}
	// if !idRegexp.MatchString(string(id)) {
	// 	return nil, fmt.Errorf("invalid ID: invalid characters")
	// }
	return json.Marshal(string(id))
}