import: Fix buggy handling of avatars in Slack conversion.

This was a pretty nasty error, where we were accidentally accessing
the parent list in this inner loop function.

This appears to have been introduced as a refactoring bug in
7822ef38c2.
This commit is contained in:
Tim Abbott
2018-11-08 15:03:39 -08:00
parent 6179bba2bd
commit e88998e6d4

View File

@@ -388,11 +388,11 @@ def process_avatars(avatar_list: List[ZerverFieldsT], avatar_dir: str, realm_id:
downloaded. For simpler conversions see write_avatar_png.
"""
def get_avatar(avatar_upload_list: List[str]) -> int:
avatar_url = avatar_upload_list[0]
def get_avatar(avatar_upload_item: List[str]) -> int:
avatar_url = avatar_upload_item[0]
image_path = os.path.join(avatar_dir, avatar_original_list[1])
original_image_path = os.path.join(avatar_dir, avatar_original_list[2])
image_path = os.path.join(avatar_dir, avatar_upload_item[1])
original_image_path = os.path.join(avatar_dir, avatar_upload_item[2])
response = requests.get(avatar_url + size_url_suffix, stream=True)
with open(image_path, 'wb') as image_file: