From d934e8114a5d9e4ae05472ebb0160afb41ff21d6 Mon Sep 17 00:00:00 2001 From: "M. Vefa Bicakci" Date: Wed, 16 Jan 2019 21:03:02 -0500 Subject: [PATCH] qubes/utils: parse_size: Fix string comparison This commit resolves a bug which causes strings such as "350MiB" to be rejected by parse_size, due to the fact that parse_size changes the case of letters in the input string ("350MiB") to uppercase ("350MIB"), but fails to do the same for the elements of the units conversion table. The correction is simple: Apply the same case change to the units table elements before comparison. --- qubes/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qubes/utils.py b/qubes/utils.py index 63c49d90..ccf96b08 100644 --- a/qubes/utils.py +++ b/qubes/utils.py @@ -100,7 +100,7 @@ def parse_size(size): return int(size) for unit, multiplier in units: - if size.endswith(unit): + if size.endswith(unit.upper()): size = size[:-len(unit)].strip() return int(size) * multiplier