-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unescape slnf original solution path #46833
base: release/9.0.3xx
Are you sure you want to change the base?
Unescape slnf original solution path #46833
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 2 out of 4 changed files in this pull request and generated no comments.
Files not reviewed (2)
- test/TestAssets/TestProjects/TestAppWithSlnxAndSolutionFoldersWithSpecialCharacters/App.slnf: Language not supported
- test/TestAssets/TestProjects/TestAppWithSlnxAndSolutionFoldersWithSpecialCharacters/[email protected]: Language not supported
Comments suppressed due to low confidence (1)
src/Cli/dotnet/SlnFileFactory.cs:96
- Verify if
Uri.UnescapeDataString
is the correct method to use for unescaping the solution path. Ensure it does not introduce any unintended side effects.
filteredSolution.Description = Uri.UnescapeDataString(originalSolutionPathAbsolute);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 2 out of 4 changed files in this pull request and generated no comments.
Files not reviewed (2)
- test/TestAssets/TestProjects/TestAppWithSlnxAndSolutionFoldersWithSpecialCharacters/App.slnf: Language not supported
- test/TestAssets/TestProjects/TestAppWithSlnxAndSolutionFoldersWithSpecialCharacters/[email protected]: Language not supported
aa8c191
to
b578e16
Compare
@@ -78,7 +78,7 @@ public static SolutionModel CreateFromFilteredSolutionFile(string filteredSoluti | |||
try | |||
{ | |||
JsonElement root = JsonDocument.Parse(File.ReadAllText(filteredSolutionPath)).RootElement; | |||
originalSolutionPath = root.GetProperty("solution").GetProperty("path").GetString(); | |||
originalSolutionPath = Uri.UnescapeDataString(root.GetProperty("solution").GetProperty("path").GetString()); | |||
filteredSolutionProjectPaths = root.GetProperty("solution").GetProperty("projects").EnumerateArray().Select(p => p.GetString()).ToArray(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also unescape the absolute path and project paths?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I thought about unescaping the absolute path, but that is generated by the system so I wouldn't expect it to be escaped (as it would by the json serializer), and maybe it tries to incorrectly parse certain characters. I may be completely wrong tho, would love to hear opinions on this.
For the project paths, you're right, I agree
Related to dotnet/msbuild#11050
If the original solution file name contains a special character such as
@
, it will be escaped when reading the json slnf file. Hence, it looks for the file with the incorrect path. This attempts to unescape the original solution path