backup: fix restoring template VMs

os.path.splitext fails on path without proper file base name, like
'/something/..000'. Use plain string methods (rsplit).

Fixes QubesOS/qubes-issues#3167
This commit is contained in:
Marek Marczykowski-Górecki 2017-10-16 03:04:59 +02:00
parent 17670eae1b
commit 9cdb2a8152
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -630,8 +630,9 @@ class ExtractWorker3(Process):
os.remove(filename)
continue
else:
(basename, ext) = os.path.splitext(self.tar2_current_file)
previous_chunk_number = int(ext[1:])
# os.path.splitext fails to handle 'something/..000'
(basename, ext) = self.tar2_current_file.rsplit('.', 1)
previous_chunk_number = int(ext)
expected_filename = basename + '.%03d' % (
previous_chunk_number+1)
if expected_filename != filename: