Merge lp:~mterry/duplicity/pydrive-cache-fix into lp:~duplicity-team/duplicity/0.8-series

Proposed by Michael Terry
Status: Merged
Merged at revision: 1502
Proposed branch: lp:~mterry/duplicity/pydrive-cache-fix
Merge into: lp:~duplicity-team/duplicity/0.8-series
Diff against target: 24 lines (+4/-3)
1 file modified
duplicity/backends/pydrivebackend.py (+4/-3)
To merge this branch: bzr merge lp:~mterry/duplicity/pydrive-cache-fix
Reviewer Review Type Date Requested Status
duplicity-team Pending
Review via email: mp+375465@code.launchpad.net

Description of the change

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.

To post a comment you must log in.
Revision history for this message
Michael Terry (mterry) :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'duplicity/backends/pydrivebackend.py'
2--- duplicity/backends/pydrivebackend.py 2019-06-17 18:58:56 +0000
3+++ duplicity/backends/pydrivebackend.py 2019-11-13 02:22:24 +0000
4@@ -166,16 +166,17 @@
5 return drive_file[u'id']
6
7 def _put(self, source_path, remote_filename):
8+ remote_filename = util.fsdecode(remote_filename)
9 drive_file = self.file_by_name(remote_filename)
10 if drive_file is None:
11 # No existing file, make a new one
12- drive_file = self.drive.CreateFile({u'title': util.fsdecode(remote_filename),
13+ drive_file = self.drive.CreateFile({u'title': remote_filename,
14 u'parents': [{u"kind": u"drive#fileLink",
15 u"id": self.folder}]})
16- log.Info(u"PyDrive backend: creating new file '%s'" % (util.fsdecode(remote_filename),))
17+ log.Info(u"PyDrive backend: creating new file '%s'" % (remote_filename,))
18 else:
19 log.Info(u"PyDrive backend: replacing existing file '%s' with id '%s'" % (
20- util.fsdecode(remote_filename), drive_file[u'id']))
21+ remote_filename, drive_file[u'id']))
22 drive_file.SetContentFile(util.fsdecode(source_path.name))
23 drive_file.Upload()
24 self.id_cache[remote_filename] = drive_file[u'id']

Subscribers

People subscribed via source and target branches