From 08660f6bf8f5055796879648b68fb6c08d91fd21 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Thu, 8 Dec 2011 01:06:33 +0900 Subject: [PATCH] test db integrity before upload --- anki/sync.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/anki/sync.py b/anki/sync.py index 9667a42e6..8ab7db759 100644 --- a/anki/sync.py +++ b/anki/sync.py @@ -532,6 +532,9 @@ class FullSyncer(HttpSyncer): def upload(self): runHook("sync", "upload") + # make sure it's ok before we try to upload + assert self.col.db.scalar("pragma integrity_check") == "ok" + # apply some adjustments, then upload self.col.beforeUpload() assert self.req("upload", open(self.col.path, "rb")) == "OK"