Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Document Unicode encoding behavior in Uri.GetLeftPart method#11479

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
jeffhandley merged 2 commits intomainfromcopilot/fix-11253
Jun 20, 2025

Conversation

Copilot
Copy link
Contributor

@CopilotCopilotAI commentedJun 19, 2025
edited
Loading

TheUri.GetLeftPart method performs Unicode character encoding and normalization under the hood, which can cause subtle bugs when developers expect simple string manipulation. This was reported as an issue where users were usingGetLeftPart to remove SAS tokens but discovered it does more than just string truncation.

Changes Made

Added comprehensive documentation to theUri.GetLeftPart method to clarify:

  1. Important warning: Added a prominent callout explaining that the method performs Unicode character encoding and normalization
  2. Behavioral clarification: Explicitly states it's not a simple string manipulation method and that the returned string may differ from the original URI
  3. Implementation details: Documents thatGetLeftPart is equivalent to callingGetComponents with specificUriComponents flags
  4. Example mapping: Shows howGetLeftPart(UriPartial.Authority) maps to the correspondingGetComponents call

Example of the documentation change:

>[!IMPORTANT]>The GetLeftPart method performs Unicode character encoding and normalization as part of its processing. It is not a simple string manipulation method. The returned string may differ from the original URI string due to this encoding behavior.The GetLeftPart method is equivalent to calling GetComponents with the appropriate UriComponents flags. For example:-`GetLeftPart(UriPartial.Authority)` is equivalent to`GetComponents(UriComponents.Scheme | UriComponents.UserInfo | UriComponents.Host | UriComponents.Port, UriFormat.UriEscaped)`

This documentation will help developers understand the method's true behavior and avoid unexpected results when using it for scenarios like removing query parameters or fragments from URIs.

Fixes#11253.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn moreCopilot coding agent tips in the docs.

Co-authored-by: jeffhandley <1031940+jeffhandley@users.noreply.github.com>
@CopilotCopilotAI changed the title[WIP] .GetLeftPart does unicode character encoding under the hoodDocument Unicode encoding behavior in Uri.GetLeftPart methodJun 19, 2025
Copilot finished work on behalf ofjeffhandleyJune 19, 2025 07:02
@CopilotCopilotAI requested a review fromjeffhandleyJune 19, 2025 07:02
Copy link
Member

@jeffhandleyjeffhandley left a comment

Choose a reason for hiding this comment

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

Looks good to me. @dotnet/ncl, how about someone from your team?

@jeffhandleyjeffhandley marked this pull request as ready for reviewJune 20, 2025 01:48
@jeffhandleyjeffhandley requested a review froma team as acode ownerJune 20, 2025 01:48
@jeffhandleyjeffhandley merged commite219a0b intomainJun 20, 2025
6 of 8 checks passed
@jeffhandleyjeffhandley deleted the copilot/fix-11253 branchJune 20, 2025 06:42
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@jeffhandleyjeffhandleyjeffhandley approved these changes

@MihaZupanMihaZupanMihaZupan approved these changes

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

.GetLeftPart does unicode character encoding under the hood
3 participants
@Copilot@jeffhandley@MihaZupan

[8]ページ先頭

©2009-2025 Movatter.jp