[PR #11314] [MERGED] Properly escape constructed wt command-lines #28495

Open
opened 2026-01-31 09:28:55 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/11314
Author: @ianjoneill
Created: 9/23/2021
Status: Merged
Merged: 9/24/2021
Merged by: @undefined

Base: mainHead: f-escape-constructed-wt-command-lines


📝 Commits (5)

  • b636864 Properly escape constructed wt command-lines
  • 1eb8167 Address review comment
  • 007be88 Merge remote-tracking branch 'upstream/main' into f-escape-constructed-wt-command-lines
  • 85c8794 Merge remote-tracking branch 'upstream/main' into f-escape-constructed-wt-command-lines
  • 5ac40c2 Address review comment

📊 Changes

4 files changed (+63 additions, -11 deletions)

View changed files

📝 src/cascadia/LocalTests_SettingsModel/CommandTests.cpp (+20 -1)
📝 src/cascadia/ShellExtension/OpenTerminalHere.cpp (+2 -4)
📝 src/cascadia/TerminalSettingsModel/ActionArgs.cpp (+4 -6)
📝 src/cascadia/WinRTUtils/inc/WtExeUtils.h (+37 -0)

📄 Description

Ensures that command-lines constructed to invoke wt are escaped properly.

PR Checklist

Detailed Description of the Pull Request / Additional comments

This was broken in two places - when constructing the command-line in the shell extension and in NewTerminalArgs::ToCommandline().

Both places now invoke a shared method to escape the command-line arguments that require it.

Validation Steps Performed

Added a test and additionally:

  • Invoked the shell extension from D:\Downloads\With;Semicolon.
  • Added a newWindow action to settings.json as below and ensured the new window opened without erroring.
    {
      "command": 
      {
        "action": "newWindow",
        "tabTitle": "\";foo\\"
      },
      "keys": "ctrl+shift+s"
    }
    

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/11314 **Author:** [@ianjoneill](https://github.com/ianjoneill) **Created:** 9/23/2021 **Status:** ✅ Merged **Merged:** 9/24/2021 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `f-escape-constructed-wt-command-lines` --- ### 📝 Commits (5) - [`b636864`](https://github.com/microsoft/terminal/commit/b6368642d462fead2f668852e06433c0b96052c9) Properly escape constructed `wt` command-lines - [`1eb8167`](https://github.com/microsoft/terminal/commit/1eb816745d400ec8e8682b8621f332feb0a1e067) Address review comment - [`007be88`](https://github.com/microsoft/terminal/commit/007be885c596d723037ceaf1898b46aa72d331b9) Merge remote-tracking branch 'upstream/main' into f-escape-constructed-wt-command-lines - [`85c8794`](https://github.com/microsoft/terminal/commit/85c879471a70a994ca25443ab8b7bcb08a19556a) Merge remote-tracking branch 'upstream/main' into f-escape-constructed-wt-command-lines - [`5ac40c2`](https://github.com/microsoft/terminal/commit/5ac40c2da2a22d6e5824a36fb9cca9e24a77513c) Address review comment ### 📊 Changes **4 files changed** (+63 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/LocalTests_SettingsModel/CommandTests.cpp` (+20 -1) 📝 `src/cascadia/ShellExtension/OpenTerminalHere.cpp` (+2 -4) 📝 `src/cascadia/TerminalSettingsModel/ActionArgs.cpp` (+4 -6) 📝 `src/cascadia/WinRTUtils/inc/WtExeUtils.h` (+37 -0) </details> ### 📄 Description Ensures that command-lines constructed to invoke `wt` are escaped properly. ## PR Checklist * [x] Closes #11273 * [x] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA * [x] Tests added/passed ## Detailed Description of the Pull Request / Additional comments This was broken in two places - when constructing the command-line in the shell extension and in `NewTerminalArgs::ToCommandline()`. Both places now invoke a shared method to escape the command-line arguments that require it. ## Validation Steps Performed Added a test and additionally: * Invoked the shell extension from `D:\Downloads\With;Semicolon`. * Added a `newWindow` action to `settings.json` as below and ensured the new window opened without erroring. ```json { "command": { "action": "newWindow", "tabTitle": "\";foo\\" }, "keys": "ctrl+shift+s" } ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:28:55 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#28495