open-webui / open-webui/computer
Bug: display_file tool produces doubled/invalid file paths in UI
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 569
- Forks
- 79
- PR merge metrics
- No merged PRs in 30d
Description
Bug: display_file tool produces doubled/invalid file paths in UI
Summary
The display_file tool always returns full_path as an absolute path (e.g. C:\Users\....\Documents\GIT\scratchpad\file.md). The cptr UI then concatenates workspace + full_path, producing a doubled, invalid path like:
C:\Users\...\Documents\GIT/C:\Users\...\Documents\GIT\scratchpad\file.md
This makes file links from display_file unclickable/broken in the UI.
Environment
- cptr version: 0.9.21
- OS: Windows 11
- Architecture: AMD64
- Workspace path:
C:\Users\...\Documents\GIT
Reproduction
Call display_file with any relative path, e.g.:
display_file(path="scratchpad/test.md")
Tool response (JSON):
{
"type": "file",
"path": "scratchpad\\test.md",
"full_path": "C:\\Users\\....\\Documents\\GIT\\scratchpad\\test.md",
"workspace": "C:\\Users\\.....\\Documents\\GIT",
"name": "test.md",
"size": 7467,
"mime_type": "text/markdown",
"kind": "markdown"
}
UI rendering (broken):
The UI displays a link/path constructed as {workspace}/{full_path}:
C:\Users\....\Documents\GIT/C:\Users\....\Documents\GIT\scratchpad\test.md
This path is invalid — it duplicates the workspace root prefix.
Tested Variants
All of these produce the same doubled-path result in the UI:
Input path |
Tool full_path output |
UI renders |
|---|---|---|
scratchpad/test.md |
C:\Users\...\GIT\scratchpad\test.md |
C:\Users\...\GIT/C:\Users\...\GIT\scratchpad\test.md |
./scratchpad/test.md |
C:\Users\...\GIT\scratchpad\test.md |
C:\Users\...\GIT/C:\Users\...\GIT\scratchpad\test.md |
test.md (root) |
C:\Users\...\GIT\test.md |
C:\Users\...\GIT/C:\Users\...\GIT\test.md |
C:\Users\...\test.md |
C:\Users\...\GIT\scratchpad\test.md |
C:\Users\...\GIT/C:\Users\...\GIT\scratchpad\test.md |
/scratchpad/test.md |
(rejected: "Path traversal rejected") | N/A |
/test.md |
(rejected: "Path traversal rejected") | N/A |
Root Cause
The display_file tool resolves the input path to an absolute path and stores it in full_path. The UI then constructs the display path as {workspace}/{full_path}. Since full_path already starts with the workspace path, the workspace prefix is duplicated.
Expected Behavior
The UI should use either:
full_pathdirectly (it's already absolute), or{workspace}/{path}(joining workspace with the relative path)
...but not {workspace}/{full_path}.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the display_file entry point and trace the UI rendering that constructs links from workspace, path, and full_path. Reproduce the Windows case with a relative path, then verify that file links no longer duplicate the workspace prefix and remain clickable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 75/100