Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: resolve this instance's own file URLs in edit_image regardless of the URL host - #29691

Open
Classic298 wants to merge 1 commit into
open-webui:devfrom
Classic298:fix-edit-image-file-url
Open

fix: resolve this instance's own file URLs in edit_image regardless of the URL host#29691
Classic298 wants to merge 1 commit into
open-webui:devfrom
Classic298:fix-edit-image-file-url

Conversation

@Classic298

Copy link
Copy Markdown
Member

The native edit_image tool fails with "400: [ERROR: Error loading image]" whenever the model hands it an absolute URL for an image Open WebUI already stores. Such a URL is treated as local only when its host string matches the incoming request's host exactly, so a default-port form, a container name or any host the model composed itself falls through to an outbound HTTP fetch instead. That fetch asks /api/v1/files/{id}/content without a session, gets a 401, and the user sees the generic 400.

Match the file URL on its path and let the existing local branch resolve it. Fetching that endpoint over the network can never succeed for a local or a remote instance, because it requires an authenticated user, so the host comparison only decided which way the request failed. Access control is unchanged: the local branch still goes through get_file_content_by_id, which enforces owner, admin or shared access.

Fixes #29220

Contributor License Agreement

…f the URL host

The native edit_image tool fails with "400: [ERROR: Error loading image]" whenever the model hands it an absolute URL for an image Open WebUI already stores. Such a URL is treated as local only when its host string matches the incoming request's host exactly, so a default-port form, a container name or any host the model composed itself falls through to an outbound HTTP fetch instead. That fetch asks /api/v1/files/{id}/content without a session, gets a 401, and the user sees the generic 400.

Match the file URL on its path and let the existing local branch resolve it. Fetching that endpoint over the network can never succeed for a local or a remote instance, because it requires an authenticated user, so the host comparison only decided which way the request failed. Access control is unchanged: the local branch still goes through get_file_content_by_id, which enforces owner, admin or shared access.

Fixes open-webui#29220
@kbruegge

kbruegge commented Sep 8, 2026

Copy link
Copy Markdown

Looks good as far as I can tell. Not sure if the tool itself needs to be updated with clearer instructions for the model as well. Haven't checked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants