mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-19 04:10:26 -05:00
[PR #20169] [CLOSED] fix: attached image was regenerated instead of edited #129143
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/20169
Author: @proAlexandr
Created: 12/25/2025
Status: ❌ Closed
Base:
dev← Head:2025-12-25-fix-image-editing📝 Commits (1)
b0525b9fix: image editing📊 Changes
2 files changed (+37 additions, -31 deletions)
View changed files
📝
backend/open_webui/routers/images.py(+21 -10)📝
backend/open_webui/utils/middleware.py(+16 -21)📄 Description
Pull Request Checklist
Note to first-time contributors: Please open a discussion post in Discussions to discuss your idea/fix with the community before creating a pull request, and describe your changes before submitting a pull request.
This is to ensure large feature PRs are discussed with the community first, before starting work on it. If the community does not want this feature or it is not relevant for Open WebUI as a project, it can be identified in the discussion before working on the feature and submitting the PR.
Before submitting, make sure you've checked the following:
devbranch. Not targeting thedevbranch will lead to immediate closure of the PR.Changelog Entry
Description
This diff fixes image editing when image is attached to the message.
Explanation:
There are two issues:
file.get("type")is not equal to "image". It equals to "file", soget_images_from_messagesfails to find any images in the chat. Because of that it creates a new image instead of edits provided one.load_url_imagefails to get "data:..." urils since the argument didn't match to any of conditions. Data is a uuid likecc367ba4-2607-49d4-a2da-27bf41e35642. So I added third consition to check if data is id and extracted common code toload_url_image_by_idTest Plan:

Here is an input:
before: (it creates a new image)

after:

the image is edited
Fixed
Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.