Skip to content

issue: hardcoded MIME type in profile image endpoints prevents correct rendering of non-PNG images #20168

@landerrosette

Description

@landerrosette

Check Existing Issues

  • I have searched for any existing and/or related issues.
  • I have searched for any existing and/or related discussions.
  • I have also searched in the CLOSED issues AND CLOSED discussions and found no related items (your issue might already be addressed on the development branch!).
  • I am using the latest version of Open WebUI.

Installation Method

Docker

Open WebUI Version

v0.6.43

Ollama Version (if applicable)

No response

Operating System

Debian 12

Browser (if applicable)

No response

Confirmation

  • I have read and followed all instructions in README.md.
  • I am using the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • I have provided every relevant configuration, setting, and environment variable used in my setup.
  • I have clearly listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc).
  • I have documented step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation. My steps:
  • Start with the initial platform/version/OS and dependencies used,
  • Specify exact install/launch/configure commands,
  • List URLs visited, user input (incl. example values/emails/passwords if needed),
  • Describe all options and toggles enabled or changed,
  • Include any files or environmental changes,
  • Identify the expected and actual result at each stage,
  • Ensure any reasonably skilled user can follow and hit the same issue.

Expected Behavior

When a model or user profile image is stored with a valid data URI (e.g., data:image/svg+xml;base64…), the corresponding endpoints (/models/model/profile/image and /users/{id}/profile/image) should return the image with correct Content-Type header.

Actual Behavior

The backend endpoints currently hardcode the response media type to image/png, regardless of the actual data URI string stored in the database.

elif model.meta.profile_image_url.startswith("data:image"):
try:
header, base64_data = model.meta.profile_image_url.split(",", 1)
image_data = base64.b64decode(base64_data)
image_buffer = io.BytesIO(image_data)
return StreamingResponse(
image_buffer,
media_type="image/png",
headers={
"Content-Disposition": "inline; filename=image.png",
**cache_headers,
},
)

In contrast, the Model Editor view works fine because it renders the base64 string directly from the model metadata, bypassing the two API endpoints.

Steps to Reproduce

  1. Send an API request with an SVG profile image.
    curl -X POST "http://localhost:8080/api/v1/models/model/update" \
      -H "Authorization: Bearer …" \
      -H "Content-Type: application/json" \
      -d '{
        "id": "test-model",
        "name": "Test Model",
        "meta": {
          "profile_image_url": "data:image/svg+xml;base64,…"
        }
      }'
  1. Navigate to the Model List view and observe a broken icon.
  2. navigate to the Model Edit view and observe a correct icon.

Logs & Screenshots

Image Image Image

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions