backup: Ensure entries in the tx are bytes

We could end up in some cases with string-encoded statements.
This commit is contained in:
Christian Decker
2021-01-07 13:05:43 +01:00
parent 2bee4a0fc2
commit d28d68cb16

View File

@@ -192,7 +192,8 @@ class FileBackend(Backend):
def add_change(self, entry: Change) -> bool:
typ = b'\x01' if entry.snapshot is None else b'\x02'
if typ == b'\x01':
payload = b'\x00'.join([t.encode('UTF-8') for t in entry.transaction])
stmts = [t.encode('UTF-8') if isinstance(t, str) else t for t in entry.transaction]
payload = b'\x00'.join(stmts)
elif typ == b'\x02':
payload = entry.snapshot