Skip to content

Commit 41b0a9f

Browse files
committed
Handle broken punycode in IDN hostnames.
This would have raised an uncaught exception previously, but is now caught by the newly added upstream test.
1 parent 3380327 commit 41b0a9f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

jsonschema/_format.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,10 @@ def is_host_name(instance):
237237
except ImportError:
238238
pass
239239
else:
240-
@_checks_drafts(draft7="idn-hostname", raises=idna.IDNAError)
240+
@_checks_drafts(
241+
draft7="idn-hostname",
242+
raises=(idna.IDNAError, UnicodeError),
243+
)
241244
def is_idn_host_name(instance):
242245
if not isinstance(instance, str_types):
243246
return True

0 commit comments

Comments
 (0)