Bugfix for handling 0 byte modification in diff view (#356)

An exception was thrown when diff of two archives were requested.

The exception was
'''
vorta/views/diff_result.py", line 52, in parse_line
    size = int(size)
ValueError: invalid literal for int() with base 10: ''
'''

which was caused by diff line:

'''
0 B   -2.6 kB home/philroche/.config/google-chrome/Profile 1/QuotaManager-journal
'''

This commit fixes the issue by only stripping +/- from string if they exist.

* Remove trailing whitespace causing flake8 failures
This commit is contained in:
Philip Roche 2019-09-04 09:03:42 +01:00 committed by Hofer-Julian
parent f103d78af1
commit 6c69f3689e
1 changed files with 4 additions and 2 deletions

View File

@ -40,9 +40,11 @@ class DiffResult(DiffResultBase, DiffResultUI):
unit = line_splitted[2]
else:
change_type = "modified"
# Remove '+' or '-' sign at the front
size = line_splitted[0][1:]
size = line_splitted[0]
unit = line_splitted[1]
# If present remove '+' or '-' sign at the front
if '+' in size or '-' in size:
size = size[1:]
if line_splitted[0].startswith("["):
size = 0