1
0
mirror of https://github.com/instaloader/instaloader.git synced 2024-10-03 22:07:11 +02:00

Fix format_string_contains_key()

AttributeError occured if no parsable field was found in the specified
pattern.
Reported in #84.
This commit is contained in:
André Koch-Kramer 2018-03-21 22:25:40 +01:00
parent a7f89e4327
commit 90a1b73d21

View File

@ -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