Skip to content

[bug][alpha] WelcomeRecentFiles formatPath() ignores maxLength when the path has at most two segments #38075

@bountyhunter713

Description

@bountyhunter713

Project

ide

Description

WelcomeRecentFiles.tsx defines formatPath(path, maxLength = 60) to shorten long paths for the secondary label next to each recent project name.

After normalizing slashes, if normalized.length > maxLength, the function splits on / and:

  • If parts.length <= 2, it returns the full normalized string, even when that string is far longer than maxLength.

So the maxLength parameter is only partially enforced. Deep paths that collapse to one or two segments (e.g. synthetic or unusual paths, or very long single segment names) can still produce an arbitrarily long display string and break the row layout.

This is not the same issue as bounty #25103 (misleading ~/ prefix for non-home paths). That issue targets semantic confusion from the ~/ heuristic; this one is unconditional failure to cap length in the parts.length <= 2 branch.

Single root cause: the early return for parts.length <= 2 does not apply any max-length truncation (ellipsis, middle-ellipsis, or tail-only) after the length check.

Error Message

Debug Logs

System Information

Cortex IDE alpha
OS: Windows (win32)
Component: src/components/cortex/WelcomeRecentFiles.tsx

Screenshots

Image

Steps to Reproduce

  1. Ensure a recent project entry whose stored path normalizes to two or fewer path segments but more than 60 characters total (e.g. a very long folder name under a drive root).
  2. Open the Welcome page or Welcome tab where WelcomeRecentFiles is shown.
  3. Observe the secondary path text for that row.

Expected Behavior

Displayed path respects maxLength (or equivalent UI constraint) in all branches, e.g. via ellipsis, middle truncation, or tail-only display.

Actual Behavior

Full normalized path may be shown past the intended cap when parts.length <= 2.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingideIssues related to IDEvalidValid issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions