From bcf99374f7252b7c758da3cfb109c938869c85db Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Wed, 7 Oct 2026 13:47:01 +0200 Subject: [PATCH] fix: JPEG and WebP images from a model are stored inside the chat instead of as files (#31975) When a model returned an image, only PNG was saved as a file. JPEG and WebP images stayed as raw base64 data inside the chat in the database, so a 1.5 MB JPEG made the stored chat 1.5 MB larger. These images are now saved as files and the chat keeps only a link to them, the same way PNG already worked. Fixes #31916 --- backend/open_webui/utils/middleware.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/open_webui/utils/middleware.py b/backend/open_webui/utils/middleware.py index 1e211c9ae7..0f83a49299 100644 --- a/backend/open_webui/utils/middleware.py +++ b/backend/open_webui/utils/middleware.py @@ -1766,7 +1766,7 @@ async def get_image_urls(delta_images, request, metadata, user) -> list[str]: if not url: continue - if url.startswith('data:image/png;base64'): + if re.match(r'data:image/\w+;base64', url): url = await get_image_url_from_base64(request, url, metadata, user) image_urls.append(url)