-
-
Notifications
You must be signed in to change notification settings - Fork 448
Fix DialogJump UriFormatException when navigating to root directories #4050
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
Closed
Conversation
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
Replace new Uri() with Uri.TryCreate() to handle malformed file: URIs gracefully. When file: prefix is present but URI parsing fails (e.g., "file:C:" without trailing slash), the code now strips the prefix and uses the path directly instead of throwing an exception. Co-authored-by: Jack251970 <53996452+Jack251970@users.noreply.github.com>
@Copilot
Copilot
AI
changed the title
(削除) [WIP] Fix dialog jump functionality in root directory (削除ここまで)
(追記) Fix DialogJump UriFormatException when navigating to root directories (追記ここまで)
Oct 15, 2025
Copilot finished work on behalf of
Jack251970
October 15, 2025 04:49
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.
Uh oh!
There was an error while loading. Please reload this page.
Problem
The DialogJump function fails when attempting to navigate to root directories (e.g.,
C:\
), throwing aUriFormatException
with the message:This occurs when paths are passed with a
file:
prefix but without proper URI formatting, such asfile:C:
(missing the trailing slash).Root Cause
The
CheckPath
method inDialogJump.cs
was using theUri
constructor directly:The
Uri
constructor throwsUriFormatException
when given malformed file URIs likefile:C:
(without trailing slash), causing DialogJump to fail for root directories.Solution
Replaced the direct
Uri
constructor call withUri.TryCreate()
to gracefully handle malformed URIs:This approach:
Uri.LocalPath
propertyfile:
prefixDirectory.Exists()
andFile.Exists()
checks to determine if the path is validTesting
Verified the fix handles various path formats correctly:
file:C:
,file:D:
no longer throw exceptionsfile:///C:/
,file://C:/
continue to workC:\
,D:\
work as expectedshell:MyComputerFolder
continue to workFixes #[issue_number]
Original prompt
Fixes #4048
💬 Share your feedback on Copilot coding agent for the chance to win a 200ドル gift card! Click here to start the survey.