Repository navigation
Slai Agent Runtime: Preserve decoded text in web response previews - #28167
Open
Slai.life (huong8373tt-beep) wants to merge 1 commit into
Open
Slai.life (huong8373tt-beep) wants to merge 1 commit into
Slai.life (huong8373tt-beep) wants to merge 1 commit into
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Copilot started reviewing on behalf of
Slai.life (huong8373tt-beep)
October 8, 2026 11:12
View session
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused change reuses existing decoding, preserves binary-response behavior, and includes relevant regression coverage.
0 open findings
What changed in this PR
Fixes #27154 by preserving decoded non-ASCII text in Invoke-WebRequest string representations while retaining existing binary-response behavior.
Changes:
- Allows text responses to override
ToString()and return decodedContent. - Adds a UTF-8 regression assertion.
| File | Description |
|---|---|
| test/powershell/Modules/Microsoft.PowerShell.Utility/WebCmdlets.Tests.ps1 | Verifies ToString() preserves UTF-8 text. |
| src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebResponseObject.Common.cs | Allows overriding ToString() without changing base behavior. |
| src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/BasicHtmlWebResponseObject.Common.cs | Returns decoded text from ToString(). |
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
Preserve decoded text in
Invoke-WebRequestresponse previews so non-ASCII response content is not replaced with ASCII fallback characters.PR Context
Fix #27154.
BasicHtmlWebResponseObjectalready decodes recognized text responses using the response charset. OverrideToString()to return that decodedContent, while retaining the existing ASCII-safe preview behavior for the baseWebResponseObjectused for non-text or binary responses.This issue was reproduced on Windows with PowerShell 7.6.6 and validated with a locally built PowerShell 7.7.0-preview.5. The targeted UTF-8
Invoke-WebRequestregression test passes.This contribution was discovered while Slai Agent Runtime was operating in a Windows environment. The developer authorized this contribution after the issue was reproduced and the fix was validated.
PR Checklist