]> git.ipfire.org Git - ipfire.org.git/commitdiff
Do not try to format invalid or unknown phone numbers
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 16 Oct 2018 09:15:29 +0000 (10:15 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 16 Oct 2018 09:15:29 +0000 (10:15 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/web/__init__.py

index 01292fe06c3faa5ad230c6b250231245c6bde65e..c6af8296079d26bcf80ce8d238b2b3e208bca535 100644 (file)
@@ -293,7 +293,10 @@ class Application(tornado.web.Application):
                return month
 
        def format_phone_number(self, handler, s):
-               number = phonenumbers.parse(s, None)
+               try:
+                       number = phonenumbers.parse(s, None)
+               except phonenumbers.phonenumberutil.NumberParseException:
+                       return s
 
                return phonenumbers.format_number(number, phonenumbers.PhoneNumberFormat.INTERNATIONAL)