From 68da7cd454c959e31542b64c46929a50dba7e18c Mon Sep 17 00:00:00 2001 From: Antoine Goutenoir Date: Tue, 3 Dec 2019 21:58:49 +0100 Subject: [PATCH] Improve robustness of input addresses reading some more. --- flaskr/controllers/main_controller.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/flaskr/controllers/main_controller.py b/flaskr/controllers/main_controller.py index cb0da6f..d460c0b 100644 --- a/flaskr/controllers/main_controller.py +++ b/flaskr/controllers/main_controller.py @@ -131,8 +131,18 @@ def gather_addresses(from_list, from_file): else: addresses = from_list.replace("\r", '').split("\n") - # Remove empty lines (if any) - addresses = [a for a in addresses if a] + clean_addresses = [] + for address in addresses: + if not address: + continue + elif type(address).__name__ == 'str': + clean_addresses.append(unicode(address, 'utf-8')) + else: + clean_addresses.append(address) + addresses = clean_addresses + + # Remove empty lines (if any) and white characters + addresses = [a.strip() for a in addresses if a] return "\n".join(addresses) -- libgit2 0.21.2