Skip to content

Conversation

@MihaZupan
Copy link
Member

Together with all the other recent PRs, this removes the only remaining use of unsafe from Uri 🎉.

This helper is only used for file Uris where the path wasn't already in a canonical form. Perf is about the same.

@MihaZupan MihaZupan added this to the 11.0.0 milestone Nov 16, 2025
@MihaZupan MihaZupan requested a review from a team November 16, 2025 05:46
@MihaZupan MihaZupan self-assigned this Nov 16, 2025
@MihaZupan MihaZupan marked this pull request as ready for review November 16, 2025 05:46
Copilot AI review requested due to automatic review settings November 16, 2025 05:46
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Copilot finished reviewing on behalf of MihaZupan November 16, 2025 05:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR successfully removes unsafe code from URI path dot and slash unescaping, eliminating the last remaining use of unsafe from the Uri class. The refactoring replaces a pointer-based implementation with a safe, span-based approach while maintaining equivalent functionality.

Key Changes:

  • Replaced the unsafe method UnescapeOnly with a safe method UnescapePathSlashesAndDots
  • Removed unsafe modifier from GetCanonicalPath method
  • Refactored from pointer arithmetic with goto-based control flow to a cleaner loop-based implementation using Span

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant