From 636098a350a03c25172f6986f47d93ea2a5c19ba Mon Sep 17 00:00:00 2001 From: Ed Velez Date: Tue, 5 Nov 2024 09:16:56 -0600 Subject: [PATCH] Allow values without a suffix to be interpreted as bytes --- .../holland/backup/mysqldump/plugin.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/holland.backup.mysqldump/holland/backup/mysqldump/plugin.py b/plugins/holland.backup.mysqldump/holland/backup/mysqldump/plugin.py index 62faf732..96e86c35 100644 --- a/plugins/holland.backup.mysqldump/holland/backup/mysqldump/plugin.py +++ b/plugins/holland.backup.mysqldump/holland/backup/mysqldump/plugin.py @@ -567,10 +567,14 @@ def parse_size(units_string): units = "kKmMgGtTpPeE" - match = re.match(r"^(\d+(?:[.]\d+)?)([%s])$" % units, units_string) + match = re.match(r"^(\d+(?:[.]\d+)?)([%s]?)$" % units, units_string) if not match: raise ValueError("Invalid constant size syntax %r" % units_string) number, unit = match.groups() + + if not unit: + return int(float(number)) + unit = unit.upper() exponent = "KMGTPE".find(unit)