[GH-ISSUE #269] Bug: display_file tool produces doubled/invalid file paths in UI #183

Open
opened 2026-10-18 14:03:38 +00:00 by bsakaguchi · 1 comment
Owner

Originally created by @Classic298 on GitHub (Sep 8, 2026).
Original GitHub issue: https://github.com/open-webui/computer/issues/269

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:

  1. full_path directly (it's already absolute), or
  2. {workspace}/{path} (joining workspace with the relative path)

...but not {workspace}/{full_path}.

Originally created by @Classic298 on GitHub (Sep 8, 2026). Original GitHub issue: https://github.com/open-webui/computer/issues/269 # 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): ```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**: 1. `full_path` directly (it's already absolute), **or** 2. `{workspace}/{path}` (joining workspace with the relative path) ...but not `{workspace}/{full_path}`.
Author
Owner

@owui-terminator[bot] commented on GitHub (Sep 8, 2026):

🔍 Related Issues Found

I found some existing issues that might be related. Please check if any of these are duplicates or contain helpful solutions:

  1. 🟢 #246 bug: image previews never render on Windows — frontend sends backslash paths to /api/workspace/files/serve
    Both issues are about frontend file-path handling on Windows, where the UI constructs broken file URLs from paths returned by the backend. Issue #246 specifically discusses the frontend's path normalization/URL-building logic for file display, which is the same layer causing the doubled path in #269.
    by gucazcode

💡 If your issue is a duplicate, please close it and add any additional details to the existing issue instead.

This comment was generated automatically. React with 👍 if helpful, 👎 if not.

<!-- gh-comment-id:5585081521 --> @owui-terminator[bot] commented on GitHub (Sep 8, 2026): <!-- terminator-bot:related-issues-reply --> 🔍 **Related Issues Found** I found some existing issues that might be related. Please check if any of these are duplicates or contain helpful solutions: 1. 🟢 [#246](https://github.com/open-webui/computer/issues/246) **bug: image previews never render on Windows — frontend sends backslash paths to `/api/workspace/files/serve`** *Both issues are about frontend file-path handling on Windows, where the UI constructs broken file URLs from paths returned by the backend. Issue #246 specifically discusses the frontend's path normalization/URL-building logic for file display, which is the same layer causing the doubled path in #269.* *by gucazcode* --- 💡 If your issue is a duplicate, please close it and add any additional details to the existing issue instead. *This comment was generated automatically.* React with 👍 if helpful, 👎 if not.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
open-webui/computer#183
No description provided.