Skip to content
This repository was archived by the owner on Jul 21, 2025. It is now read-only.

dinsic_2020-04-22_1

@babolivier babolivier tagged this 22 Apr 10:41
The spec says that /store-invite requests should be done using the 'application/json' mimetype, but currently Sydent chokes on such requests, because it first extracts its params from the request, doing the right thing if the content-type is JSON, but, when trying to compute the dict of substitutions to apply to the email template, looks for them in request.args, which is empty when using 'application/json'.

On top of that, json.dumps() outputs a dict which keys and string values are of type 'unicode', which Python 2 doesn't consider to be strings (or at least not the same as 'str'), so the arguments wouldn't be added to the substitutions dict.

This bug went unnoticed because Synapse isn't compliant with the spec here and sends that data using the 'application/x-www-form-urlencoded' mimetype. This is tracked in https://github.com/matrix-org/synapse/issues/5634.

This makes Sydent not try to re-extract the params from the request.args, but instead use the ones it has already extracted the right way. It also changes the type comparison on the params' values, comparing them with six.string_types instead of only the 'str' type.
Assets 2
Loading