Bug: display_file tool produces doubled/invalid file paths in UI

Open Beginner friendly
#269 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
75/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
frontend

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.

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:

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

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

Dominant language
Python
Stars
570
Forks
79
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from open-webui/computer

All issues in open-webui/computer

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.