From 719a062bcb7b08a56e6576dcd75f4244e6053209 Mon Sep 17 00:00:00 2001 From: Abhilash Raj Date: Wed, 17 Jul 2019 09:48:52 -0700 Subject: Fix IndexError when parsing unexpectedly ending quoted-string. (GH-14813) This exception was caused because the input ended unexpectedly with only one single quote instead of a pair with some value inside it. --- Lib/email/_header_value_parser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Lib/email/_header_value_parser.py') diff --git a/Lib/email/_header_value_parser.py b/Lib/email/_header_value_parser.py index 66b042ee0e..daff57b9cf 100644 --- a/Lib/email/_header_value_parser.py +++ b/Lib/email/_header_value_parser.py @@ -1191,7 +1191,7 @@ def get_bare_quoted_string(value): "expected '\"' but found '{}'".format(value)) bare_quoted_string = BareQuotedString() value = value[1:] - if value[0] == '"': + if value and value[0] == '"': token, value = get_qcontent(value) bare_quoted_string.append(token) while value and value[0] != '"': -- cgit v1.2.1