From: Marcel van der Veldt Date: Tue, 28 Mar 2023 20:58:54 +0000 (+0200) Subject: fix reading embedded images X-Git-Url: https://git.kitaultman.com/?a=commitdiff_plain;h=6f2f9b34fe758560c1810862451a06d36655bfcb;p=music-assistant-server.git fix reading embedded images --- diff --git a/music_assistant/server/helpers/tags.py b/music_assistant/server/helpers/tags.py index e4fa31e5..e8b19a82 100644 --- a/music_assistant/server/helpers/tags.py +++ b/music_assistant/server/helpers/tags.py @@ -385,10 +385,13 @@ async def get_embedded_image(input_file: str | AsyncGenerator[bytes, None]) -> b if file_path == "-": # feed the file contents to the process async def chunk_feeder(): - async for chunk in input_file: - await proc.write(chunk) - - proc.write_eof() + try: + async for chunk in input_file: + if proc.closed: + break + await proc.write(chunk) + finally: + proc.write_eof() proc.attach_task(chunk_feeder())