Urlencode POST to conduit
Phabricator API expects POST be urlencoded, much like when a browser
submit a form (Content-Type: x-www-form-urlencoded) with the payload
being urlencoded.
As an example, when doing a `maniphest.edit` to add a comment containing
'http://example.org/r/+/1234', the content is send as is but urldecoded
by Phabricator which show with: 'http://example.org/r/ /1234', the '+'
has been decoded to a space.
We previously encountered the issue with commit message which we escapes
in the soy template: ${escapedSubject|escapeUri} which is merely a
workaround. Some support request got send previously at:
https://github.com/google/closure-templates/issues/152 which missed the
lack of urlencoding in the POST.
Instead of sending a StringEntity with 'param=<json>', use a
UrlEncodedFormEntity which takes care of encoding. Soy templates can
then drop usage of `escapeUri`.
Bug: https://phabricator.wikimedia.org/T280197
Change-Id: Icee02a62853817ecaa73403c44ce557634ecb07e
1 file changed