Skip to content

Commit

Permalink
Fix unbound access of log (when the captured exception is a timeout) (
Browse files Browse the repository at this point in the history
  • Loading branch information
sarayourfriend authored Sep 9, 2024
1 parent e0130b2 commit de091ba
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion api/api/utils/image_proxy/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ async def get_image_extension(media_info: MediaInfo) -> str | None:
else:
log = logger.error

log("upstream_thumbnail_exception", exc=exc, exc_info=True)
log("upstream_thumbnail_exception", exc=exc, exc_info=True)

raise UpstreamThumbnailException(
"Failed to render thumbnail due to inability to check media "
Expand Down
5 changes: 3 additions & 2 deletions api/test/unit/utils/test_image_proxy.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import asyncio
import contextlib
from dataclasses import replace
from urllib.parse import urlencode
Expand Down Expand Up @@ -336,8 +337,8 @@ def test_get_successful_records_response_code(
"aiohttp.client_exceptions.ClientConnectionError",
),
(
client_exceptions.ServerTimeoutError("whoops"),
"aiohttp.client_exceptions.ServerTimeoutError",
asyncio.TimeoutError("whoops"),
"builtins.TimeoutError",
),
(
client_exceptions.ClientSSLError(MOCK_CONNECTION_KEY, OSError()),
Expand Down

0 comments on commit de091ba

Please sign in to comment.