Skip to content

path split returns incorrect first component for drive-relative paths #18607

Description

@plum7x

Bug report form

  • I have done a basic search of the issue tracker to find any existing issues that are similar.
  • I have checked that my version is at least the latest stable release available via my installation method.

Describe the bug

When using path split on a Windows drive-relative path (e.g., C:Desktop), the first component in the returned array incorrectly includes a trailing backslash (C:\).
In Windows, C:\ (root directory) and C: (current directory of drive C) have distinct meanings. While a standard absolute path requires retaining the separator, the command should not automatically append characters that were not originally present in the input.

How to reproduce

~> 'C:\Users\UserName' | path split
╭───┬──────────╮
│ 0C:\      │
│ 1Users    │
│ 2UserName │
╰───┴──────────╯
~> 'C:Desktop' | path split
╭───┬─────────╮
│ 0C:\     │ # Bug: Backslash is incorrectly appended1Desktop │
╰───┴─────────╯

Expected behavior

path split should preserve the drive letter exactly as inputted without auto-completing it into a root path.

~> 'C:\Users\UserName' | path split
╭───┬──────────╮
│ 0C:\      │
│ 1Users    │
│ 2UserName │
╰───┴──────────╯
~> 'C:Desktop' | path split
╭───┬─────────╮
│ 0C:      │ # Expected: Stays 'C:' without the '\'1Desktop │
╰───┴─────────╯

Configuration

~> version | transpose key value | to md --pretty

key value
version 0.114.1
major 0
minor 114
patch 1
branch
commit_hash 0df4ca2
build_os windows-x86_64
build_target x86_64-pc-windows-msvc
rust_version rustc 1.95.0 (59807616e 2026-04-14)
rust_channel 1.95.0-x86_64-pc-windows-msvc
cargo_version cargo 1.95.0 (f2d3ce0bd 2026-03-21)
build_time 2026-07-11 16:22:26 +00:00
build_rust_channel release
allocator standard
features default, lsp, mcp, network, plugin, rustls-tls, sqlite, trash-support
installed_plugins
experimental_options example=false, dc-glob=false, reorder-cell-paths=true, pipefail=true, enforce-runtime-annotations=true, native-clip=false, cell-path-types=false

Metadata

Metadata

Assignees

No one assigned

    Labels

    status:needs-triageAn issue that hasn't had any proper look

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions