Skip to content

Commit

Permalink
Fix: When restoring to an existing larger-than-version file, don't co…
Browse files Browse the repository at this point in the history
…mplain. Closes #34
  • Loading branch information
wamdam committed Mar 26, 2019
1 parent af96dfe commit c8d4fd1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/backy2/io/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def open_r(self, io_name):


def open_w(self, io_name, size=None, force=False):
# parameter size is version's size.
self.mode = 'w'
_s = re.match('^file://(.+)$', io_name)
if not _s:
Expand All @@ -62,7 +63,7 @@ def open_w(self, io_name, size=None, force=False):
logger.error('Target already exists: {}'.format(io_name))
exit('Error opening restore target. You must force the restore.')
else:
if size < self.size():
if self.size() < size:
logger.error('Target size is too small. Has {}b, need {}b.'.format(self.size(), size))
exit('Error opening restore target.')
else:
Expand Down

0 comments on commit c8d4fd1

Please sign in to comment.