From 90a1b73d21bdb12a836120a299efd4413defccef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Koch-Kramer?= Date: Wed, 21 Mar 2018 22:25:40 +0100 Subject: [PATCH] Fix format_string_contains_key() AttributeError occured if no parsable field was found in the specified pattern. Reported in #84. --- instaloader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instaloader.py b/instaloader.py index ce372ba..c3571b1 100755 --- a/instaloader.py +++ b/instaloader.py @@ -130,7 +130,7 @@ def mediaid_to_shortcode(mediaid: int) -> str: def format_string_contains_key(format_string: str, key: str) -> bool: # pylint:disable=unused-variable for literal_text, field_name, format_spec, conversion in string.Formatter().parse(format_string): - if field_name == key or field_name.startswith(key + '.'): + if field_name and (field_name == key or field_name.startswith(key + '.')): return True return False