mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-08 21:09:41 -05:00
[GH-ISSUE #8483] User can't access pdfs #53809
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?
Originally created by @Urizien on GitHub (Jan 12, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/8483
Expected Behavior:
User should be able to open pdf source
Actual Behavior:
User can't open/download pdf and he sees {"detail": "We could not find what you're looking for :/"}
Steps to Reproduce:
Create server, try to login from phone, put knowledge base in as admin, then as user from phone ask for this knowledge and try to open source mentioned by chatbot
Logs and Screenshots
@yhdelgado commented on GitHub (Jan 12, 2025):
I am facing the same issue.
@LucasVascovici commented on GitHub (Jan 14, 2025):
I think this is because of those kind of lines in
backend/open_webui/routers/files.py:You can access files only if you are an admin or you uploaded them.
@BobMiles commented on GitHub (Jan 28, 2025):
We have the same issue - shouldn't the line above check if the user is granted access to the knowledge rather than if he uploaded the file himself?
@mmcaulay commented on GitHub (Feb 2, 2025):
This is related to #8889 just a different area of the code
@pablocerdeira commented on GitHub (Feb 12, 2025):
I confirm that this issue is caused by the current implementation in files.py, specifically in the route @router.get("/{id}/content"). As pointed out, the function only checks if the user is the uploader (file.user_id == user.id) or an admin (user.role == "admin") to allow file access. This leaves out users who have legitimate access to the associated knowledge base (collection_name).
Issue Explanation:
The
get_file_content_by_idfunction needs to verify if the user has access to the knowledge base linked to the file (collection_name). Without this check, even users with read access to the knowledge base will receive a 403 Forbidden or 404 Not Found when attempting to download files.Here’s the relevant change to address this issue:
Original Code:
Updated Code:
from open_webui.models.knowledge import KnowledgesTemporary Workaround:
To apply this change without rebuilding the container, you can bind your custom files.py to the container using docker-compose:
This will ensure that your modified files.py replaces the default one during runtime.
@tarmst commented on GitHub (Feb 14, 2025):
I'll get started on a PR for this & will link it when done.
@arty-hlr commented on GitHub (Mar 29, 2025):
I also experienced this today. Hope the PR can be reviewed and merged quickly! Unfortunately there is no alternative for documents in the knowledge base as afaik only the admin can upload them and link them to a model...
@Baghla911 commented on GitHub (Jun 12, 2025):
We are still facing this issue that Knowledge Base's files are not accessible to user even with group access or even for the public knowledge basis.
@Xi-Gong commented on GitHub (Dec 7, 2025):
the issue didn't fix, and is still remain.