nncli

NextCloud Notes Command Line Interface
git clone git://git.danielmoch.com/nncli.git
Log | Files | Refs | LICENSE

commit 2e2ea742e0137cfbc62f7dc3209ad315c582ab81
parent bd3c0133c8b2849628afc42b92cce0d8d73f1349
Author: Samuel Walladge <samuel@swalladge.id.au>
Date:   Tue,  7 Nov 2017 08:56:45 +1030

urlencode posted note data

Fixes #54 (+ signs being dropped from created/updated notes)

Note data was being posted to the server as json data, but for some
reason (which is undocumented), SimpleNote seems to expect to do further
processing on the posted data apart from simply parsing as json. The
correct method for sending is to first `urllib.parse.quote` the string
containing a json dump of the note.

This was a regression introduced with the switch to using the requests
library in commit 4110c45. Unfortunately simplenote still accepted notes
without being quoted, silently dropping characters like the plus sign.

Diffstat:
Msimplenote_cli/simplenote.py | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/simplenote_cli/simplenote.py b/simplenote_cli/simplenote.py @@ -169,7 +169,8 @@ def update_note(self, note): #logging.debug('REQUEST: ' + url + ' - ' + str(note)) try: - res = requests.post(url, data=json.dumps(note), params=params) + data = urllib.parse.quote(json.dumps(note)) + res = requests.post(url, data=data, params=params) res.raise_for_status() note = res.json() except ConnectionError as e: