mirror of
https://github.com/minetest/contentdb.git
synced 2024-12-22 22:12:24 +01:00
Fix .gif profile pictures being imported
This commit is contained in:
parent
31a47018eb
commit
f9c75c2749
@ -59,7 +59,7 @@ def set_profile_picture_from_url(username: str, url: str):
|
|||||||
if user is None:
|
if user is None:
|
||||||
raise TaskError(f"Unable to find user {username}")
|
raise TaskError(f"Unable to find user {username}")
|
||||||
|
|
||||||
headers = {"Accept": "image/jpeg, image/png, image/gif"}
|
headers = {"Accept": "image/jpeg, image/png, image/webp"}
|
||||||
resp = requests.get(url, stream=True, headers=headers, timeout=15)
|
resp = requests.get(url, stream=True, headers=headers, timeout=15)
|
||||||
if resp.status_code != 200:
|
if resp.status_code != 200:
|
||||||
raise TaskError(f"Failed to download {url}: {resp.status_code}: {resp.reason}")
|
raise TaskError(f"Failed to download {url}: {resp.status_code}: {resp.reason}")
|
||||||
@ -71,8 +71,8 @@ def set_profile_picture_from_url(username: str, url: str):
|
|||||||
ext = "jpg"
|
ext = "jpg"
|
||||||
elif content_type == "image/png":
|
elif content_type == "image/png":
|
||||||
ext = "png"
|
ext = "png"
|
||||||
elif content_type == "image/gif":
|
elif content_type == "image/webp":
|
||||||
ext = "gif"
|
ext = "webp"
|
||||||
else:
|
else:
|
||||||
raise TaskError(f"Unacceptable content-type: {content_type}")
|
raise TaskError(f"Unacceptable content-type: {content_type}")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user