From: Marcel van der Veldt Date: Wed, 17 Dec 2025 09:55:56 +0000 (+0100) Subject: Fix: Dont crash on imageproxy X-Git-Url: https://git.kitaultman.com/?a=commitdiff_plain;h=92b7ee052d86094bcc668c42b9b0ca894a38be9c;p=music-assistant-server.git Fix: Dont crash on imageproxy --- diff --git a/music_assistant/controllers/metadata.py b/music_assistant/controllers/metadata.py index cee97f01..920a2b3e 100644 --- a/music_assistant/controllers/metadata.py +++ b/music_assistant/controllers/metadata.py @@ -447,7 +447,7 @@ class MetaDataController(CoreController): if "%" in path: # assume (double) encoded url, decode it path = urllib.parse.unquote_plus(path) - with suppress(FileNotFoundError): + try: image_data = await self.get_thumbnail( path, size=size, provider=provider, image_format=image_format ) @@ -458,6 +458,17 @@ class MetaDataController(CoreController): headers={"Cache-Control": "max-age=31536000", "Access-Control-Allow-Origin": "*"}, content_type=f"image/{image_format}", ) + except Exception as err: + # broadly catch all exceptions here to ensure we dont crash the request handler + if isinstance(err, FileNotFoundError): + self.logger.log(VERBOSE_LOG_LEVEL, "Image not found: %s", path) + else: + self.logger.warning( + "Error while fetching image %s: %s", + path, + str(err), + exc_info=err if self.logger.isEnabledFor(10) else None, + ) return web.Response(status=404) async def create_collage_image(