diff --git a/backend/open_webui/routers/images.py b/backend/open_webui/routers/images.py index b970bed664..c28e60da75 100644 --- a/backend/open_webui/routers/images.py +++ b/backend/open_webui/routers/images.py @@ -487,10 +487,13 @@ async def image_generations( # image model other than gpt-image-1, which is warned about on settings save size = "512x512" - if "x" in request.app.state.config.IMAGE_SIZE: + if ( + request.app.state.config.IMAGE_SIZE + and "x" in request.app.state.config.IMAGE_SIZE + ): size = request.app.state.config.IMAGE_SIZE - if "x" in form_data.size: + if form_data.size and "x" in form_data.size: size = form_data.size width, height = tuple(map(int, size.split("x")))