mirror of
https://github.com/KnugiHK/WhatsApp-Chat-Exporter.git
synced 2026-04-27 16:24:53 +00:00
Fixed integer input for --size not being casted to int #156
This commit is contained in:
@@ -332,13 +332,18 @@ def validate_args(parser: ArgumentParser, args) -> None:
|
|||||||
parser.error(
|
parser.error(
|
||||||
"When --enrich-from-vcards is provided, you must also set --default-country-code")
|
"When --enrich-from-vcards is provided, you must also set --default-country-code")
|
||||||
|
|
||||||
# Size validation
|
# Size validation and conversion
|
||||||
if args.size is not None and not isinstance(args.size, int) and not args.size.isnumeric():
|
if args.size is not None:
|
||||||
try:
|
stripped_size = args.size.strip()
|
||||||
args.size = readable_to_bytes(args.size)
|
if stripped_size.isnumeric():
|
||||||
except ValueError:
|
args.size = int(stripped_size)
|
||||||
parser.error(
|
else:
|
||||||
"The value for --split must be ended in pure bytes or with a proper unit (e.g., 1048576 or 1MB)")
|
try:
|
||||||
|
args.size = readable_to_bytes(stripped_size)
|
||||||
|
except ValueError:
|
||||||
|
parser.error(
|
||||||
|
"The value for --split must be pure bytes or use a proper unit (e.g., 1048576 or 1MB)"
|
||||||
|
)
|
||||||
|
|
||||||
# Date filter validation and processing
|
# Date filter validation and processing
|
||||||
if args.filter_date is not None:
|
if args.filter_date is not None:
|
||||||
|
|||||||
Reference in New Issue
Block a user