[PR #12348] [MERGED] Fix profile matching for paths containing unquoted whitespace #28994

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/12348
Author: @lhecker
Created: 2/3/2022
Status: Merged
Merged: 2/8/2022
Merged by: @undefined

Base: mainHead: dev/lhecker/12345-profile-matching-fixup


📝 Commits (1)

  • 5781b81 Fix profile matching for paths containing unquoted whitespace

📊 Changes

4 files changed (+99 additions, -34 deletions)

View changed files

📝 .github/actions/spelling/allow/apis.txt (+9 -7)
📝 src/cascadia/LocalTests_SettingsModel/TerminalSettingsTests.cpp (+54 -0)
📝 src/cascadia/TerminalSettingsModel/CascadiaSettings.cpp (+35 -26)
📝 src/cascadia/TerminalSettingsModel/CascadiaSettings.h (+1 -1)

📄 Description

The previous code had two bugs for:

  • paths with more than 1 whitespace
    The code joins the argv array by replacing null-word terminators with
    whitespace. Unfortunately it always referred to the separator between
    argv[0] and argv[1] for this instead of continuing to join
    those between 1 and 2, etc.
  • paths sharing a common prefix with another directory
    SearchPathW returns paths that aren't necessarily paths to files.
    A call to GetFileAttributesW was added, ensuring we only resolve file paths.

PR Checklist

Validation Steps Performed

  • Paths with more than 1 whitespace resolve correctly
  • Paths with neighboring directories sharing a common prefix resolve correctly
  • Tests added

🔄 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/12348 **Author:** [@lhecker](https://github.com/lhecker) **Created:** 2/3/2022 **Status:** ✅ Merged **Merged:** 2/8/2022 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `dev/lhecker/12345-profile-matching-fixup` --- ### 📝 Commits (1) - [`5781b81`](https://github.com/microsoft/terminal/commit/5781b81374ed4f360541a967d2fea5ded1d1f8a8) Fix profile matching for paths containing unquoted whitespace ### 📊 Changes **4 files changed** (+99 additions, -34 deletions) <details> <summary>View changed files</summary> 📝 `.github/actions/spelling/allow/apis.txt` (+9 -7) 📝 `src/cascadia/LocalTests_SettingsModel/TerminalSettingsTests.cpp` (+54 -0) 📝 `src/cascadia/TerminalSettingsModel/CascadiaSettings.cpp` (+35 -26) 📝 `src/cascadia/TerminalSettingsModel/CascadiaSettings.h` (+1 -1) </details> ### 📄 Description The previous code had two bugs for: * paths with more than 1 whitespace The code joins the argv array by replacing null-word terminators with whitespace. Unfortunately it always referred to the separator between `argv[0]` and `argv[1]` for this instead of continuing to join those between 1 and 2, etc. * paths sharing a common prefix with another directory `SearchPathW` returns paths that aren't necessarily paths to files. A call to `GetFileAttributesW` was added, ensuring we only resolve file paths. ## PR Checklist * [x] Closes #12345 * [x] I work here * [ ] Tests added/passed ## Validation Steps Performed * Paths with more than 1 whitespace resolve correctly ✅ * Paths with neighboring directories sharing a common prefix resolve correctly ✅ * Tests added ✅ --- <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:32:08 +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#28994