Skip to content

Command text on the Shell Integration details pop-up can escape the code block #272416

@Abrifq

Description

@Abrifq

I haven't checked the code who renders this part, but I'd believe this is only a visual bug, aside from maybe creating rickroll/phishing links.

For what I could skim from the visual representation, the terminal tab popup's "Shell Integration" section renders the command text by wrapping it with backticks:

`echo like this;`

However, it is possible to use backticks in a valid command, which breaks this wrapping

apt install --only-upgrade `grep 'dev' ./apt-dependencies.lock`

(the code doesn't matter, using backticks matters)

Since the command has a backtick, this breaks the wrapping:

`apt install --only-upgrade `grep 'dev' ./apt-dependencies.lock``

Does this issue occur when all extensions are disabled?: Will test later as it's a remote machine right now.

  • VS Code Version: 1.105.1 (user setup)
  • OS Version: Windows_NT x64 10.0.19045

Steps to Reproduce:

  1. Run a long running command with backticks (```) from terminal
  2. Hover over the terminal icon in the Terminal View.
The popup after hovering over the terminal tab, which has a broken input of the code
  1. The text is not escaped, which breaks the backtick.

P.S: I might be able to make a PR in a few days if the issue really happens to be simple.
Changing the wrapping to a <pre> could fix it...
and then escaping the < and > with &lt; and &gt; to make sure the command can't break by having html in the command text...
I'm open to comments!

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable buginsiders-releasedPatch has been released in VS Code Insidersterminal-shell-integrationShell integration infrastructure, command decorations, etc.verifiedVerification succeeded

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions