Fix MapPath and UsePathBase's use of implicit PathStrings #41382
+30
−15
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.
Fix MapPath and UsePathBase's use of implicit PathStrings
Fixes a regression caused by the use of implicit converters between string and PathString.
Description
PathString requires that the url path be in it's un-escaped format and defines implicit converters to/from string that will un/escape %XX values. This conversion must only happen once to avoid ambiguity issues like escaped
%characters.A regression happened in 6.0 where methods were split up for performance reasons and a helper method accidentally used string parameters instead of PathStrings. The implicit converter made this compile, but the resulting value was in the wrong format (double un-escaped).
Fixes #41168
Customer Impact
UsePathBase is used by default in some IIS scenarios and the resulting mis-formatted path can cause decoding exceptions and failed requests. This is impacting customers that have upgraded to 6.0. #41168 (comment)
Regression?
From 5.0
Risk
Corner case that's unit testable.
Verification
Packaging changes reviewed?