Sometimes the Mastodon image URL is a redirect; let httpx follow
redirects so we can load these correctly.
---
tooi/utils/images.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tooi/utils/images.py b/tooi/utils/images.py
index 8bb8911..0cf0cba 100644
--- a/tooi/utils/images.py+++ b/tooi/utils/images.py
@@ -55,7 +55,7 @@ def load_image(url: str, width: int, height: int) -> Iterator[Image.Image]:
# TODO: cache fetched images to disk in XDG_CACHE_DIR?
# This would allow cache to persist between runs
with tempfile.SpooledTemporaryFile(max_size=5 * 1024 * 1024) as tmp:
- with httpx.stream("GET", url) as response:+ with httpx.stream("GET", url, follow_redirects=True) as response: response.raise_for_status()
for data in response.iter_bytes():
tmp.write(data)
--
2.43.0