Remove potential ANSI escape sequences in strings before using in `Out-GridView` by SteveL-MSFT · Pull Request #17664 · PowerShell/PowerShell · GitHub
Skip to content

Remove potential ANSI escape sequences in strings before using in Out-GridView#17664

Merged
daxian-dbw merged 3 commits intoPowerShell:masterfrom
SteveL-MSFT:ogv-filename
Jul 12, 2022
Merged

Remove potential ANSI escape sequences in strings before using in Out-GridView#17664
daxian-dbw merged 3 commits intoPowerShell:masterfrom
SteveL-MSFT:ogv-filename

Conversation

@SteveL-MSFT
Copy link
Copy Markdown
Member

@SteveL-MSFT SteveL-MSFT commented Jul 11, 2022

PR Summary

Out-GridView specifically uses the formatted output so that it resembles what you'd see in Format-Table. This means that any ANSI that is included would be in the strings in Out-GridView even though WPF doesn't know how to render them.

The fix is as objects are being sent to Out-GridView, we use the StringDecorated class to remove known ANSI escape sequences so they are just plaintext.

PR Context

Fix #17636

PR Checklist

Copy link
Copy Markdown
Member

@daxian-dbw daxian-dbw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread src/Microsoft.Management.UI.Internal/commandHelpers/OutGridView.cs Outdated
@pull-request-quantifier-deprecated
Copy link
Copy Markdown

@daxian-dbw daxian-dbw assigned daxian-dbw and unassigned anmenaga Jul 12, 2022
@daxian-dbw daxian-dbw added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Jul 12, 2022
@daxian-dbw daxian-dbw merged commit 0295cc6 into PowerShell:master Jul 12, 2022
@SteveL-MSFT SteveL-MSFT deleted the ogv-filename branch July 12, 2022 17:12
@ghost
Copy link
Copy Markdown

ghost commented Jul 18, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log Extra Small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Get-ChildItem in Out-GridView with ANSI Escape sequences :-(

4 participants