Skip to content

WSL paths need further escape of single quotes #18006

@a4lg

Description

@a4lg

Windows Terminal version

1.20.11781.0

Windows build number

10.0.26100.0

Other Software

Ubuntu 24.04 (in WSL and source of Windows.Terminal.Wsl in the profile; any WSL distributions are affected)

Steps to reproduce

  1. Open a WSL tab.
  2. Drag and drop a file/folder (the full path needs at least one single quote ' character), say D:\John's Archive.

Expected Behavior

When

D:\John's Archive

is dropped to a WSL tab, a string which expands to:

/mnt/d/John's Archive

(single argument) in the shell should be dropped.

An example satisfying this condition includes '/mnt/d/John'"'"'s Archive' (escaping a single quote ' with '"'"' (finish quote, print a single quote character then begin quote again).

Note: the expected behavior may differ depending on which environment we should assume.
This expected behavior here is of the POSIX shell context and I think this is reasonable.

Actual Behavior

In the dropped path, single quotes in the original full path are kept as-is (D:\John's Archive'/mnt/d/John's Archive').

This is clearly wrong in the POSIX shell context because a quoted string ends before s and the space after s is not quoted and will not be preserved.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-TerminalControlIssues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.)In-PRThis issue has a related PRIssue-BugIt either shouldn't be doing this or needs an investigation.Needs-Tag-FixDoesn't match tag requirementsProduct-TerminalThe new Windows Terminal.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions