From d181133ac0bd00e309b1a3c20436cbbe8e8209c8 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 21 Dec 2016 10:42:13 +1000 Subject: [PATCH] some sync fixes - fix an extra \r\n being included at the end of the last form var - req()s in the middle of a sync should throw an exception if they receive a 403, as the calling code does not check for an empty return --- anki/sync.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/anki/sync.py b/anki/sync.py index 0acf4ea0a..53a684e4b 100644 --- a/anki/sync.py +++ b/anki/sync.py @@ -552,7 +552,7 @@ class HttpSyncer(object): # costly. We could send it as a raw post, but more HTTP clients seem to # support file uploading, so this is the more compatible choice. - def req(self, method, fobj=None, comp=6, badAuthRaises=False): + def req(self, method, fobj=None, comp=6, badAuthRaises=True): BOUNDARY=b"Anki-sync-boundary" bdry = b"--"+BOUNDARY buf = io.BytesIO() @@ -582,7 +582,8 @@ Content-Type: application/octet-stream\r\n\r\n""") tgt.close() break tgt.write(data) - buf.write(b'\r\n' + bdry + b'--\r\n') + buf.write(b"\r\n") + buf.write(bdry + b'--\r\n') size = buf.tell() # connection headers headers = {