duplicity-team team mailing list archive
-
duplicity-team team
-
Mailing list archive
-
Message #05182
[Merge] lp:~mterry/duplicity/pydrive-cache-fix into lp:duplicity
Michael Terry has proposed merging lp:~mterry/duplicity/pydrive-cache-fix into lp:duplicity.
Requested reviews:
duplicity-team (duplicity-team)
For more details, see:
https://code.launchpad.net/~mterry/duplicity/pydrive-cache-fix/+merge/375465
The pydrive backend had another of the ongoing bytes/string issues. :)
This time, it was saving a bytes filename in its internal cache after each volume upload. Then when asked for a list of files later, it would add the byte-filenames from its cache to the results. And we'd end up thinking there were two of the same filename on the backend, which would cause a crash at the end of an otherwise successful backup, because the collections code would assert on the filenames being unique.
--
Your team duplicity-team is requested to review the proposed merge of lp:~mterry/duplicity/pydrive-cache-fix into lp:duplicity.
=== modified file 'duplicity/backends/pydrivebackend.py'
--- duplicity/backends/pydrivebackend.py 2019-06-17 18:58:56 +0000
+++ duplicity/backends/pydrivebackend.py 2019-11-13 02:22:24 +0000
@@ -166,16 +166,17 @@
return drive_file[u'id']
def _put(self, source_path, remote_filename):
+ remote_filename = util.fsdecode(remote_filename)
drive_file = self.file_by_name(remote_filename)
if drive_file is None:
# No existing file, make a new one
- drive_file = self.drive.CreateFile({u'title': util.fsdecode(remote_filename),
+ drive_file = self.drive.CreateFile({u'title': remote_filename,
u'parents': [{u"kind": u"drive#fileLink",
u"id": self.folder}]})
- log.Info(u"PyDrive backend: creating new file '%s'" % (util.fsdecode(remote_filename),))
+ log.Info(u"PyDrive backend: creating new file '%s'" % (remote_filename,))
else:
log.Info(u"PyDrive backend: replacing existing file '%s' with id '%s'" % (
- util.fsdecode(remote_filename), drive_file[u'id']))
+ remote_filename, drive_file[u'id']))
drive_file.SetContentFile(util.fsdecode(source_path.name))
drive_file.Upload()
self.id_cache[remote_filename] = drive_file[u'id']
Follow ups