From 6c69f3689e24e58c7f36aab32437f46dd1f846fe Mon Sep 17 00:00:00 2001 From: Philip Roche Date: Wed, 4 Sep 2019 09:03:42 +0100 Subject: [PATCH] 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 --- src/vorta/views/diff_result.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/vorta/views/diff_result.py b/src/vorta/views/diff_result.py index e7f7c0a7..3e702cae 100644 --- a/src/vorta/views/diff_result.py +++ b/src/vorta/views/diff_result.py @@ -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