Fixes math error for negative size in diff view in archive tab

Signed-off-by: Chirag Aggarwal <thechiragaggarwal@gmail.com>
This commit is contained in:
Chirag Aggarwal 2023-03-14 18:41:19 +05:30 committed by Hofer-Julian
parent 6bc532187b
commit c4d16e250d
1 changed files with 1 additions and 1 deletions

View File

@ -266,7 +266,7 @@ def find_best_unit_for_size(size: Optional[int], metric: bool = True, precision:
if not isinstance(size, int) or size == 0: # this will also take care of the None case
return 0
power = 10**3 if metric else 2**10
n = math.floor(math.log(size * 10**precision, power))
n = math.floor(math.log(abs(size) * 10**precision, power))
return n