-
-
Notifications
You must be signed in to change notification settings - Fork 51
Fix URI path handling for encoded characters #1437
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
Conversation
|
No TODO comments were found. |
Minimum allowed line rate is |
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.
Pull request overview
This PR systematically adds Uri.UnescapeDataString() calls throughout the codebase to properly handle URI-encoded characters in file paths. This ensures that files with special characters (spaces, Unicode characters, etc.) in their names can be accessed correctly when their paths are stored as URIs.
Key Changes
- Applied
Uri.UnescapeDataString()to allUri.LocalPathaccesses before file system operations across 26 files - Refactored editor ViewModels (Video/Sound/ImageSourceEditorViewModel) to chain reactive property transformations properly
- Updated serialization code to unescape paths when writing to or reading from disk
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| PlayerView.axaml.MouseControl.cs | Unescape URI path when extracting filename for image export |
| PlayerView.axaml.FrameContextMenu.cs | Unescape URI path when extracting filename for image export |
| MainView.axaml.InitializeMenuBar.cs | Unescape URI path for element deletion operations |
| SourceOperatorsTabViewModel.cs | Unescape URI paths for view state file operations |
| OutputViewModel.cs | Unescape URI path when determining default output location |
| OutputTabViewModel.cs | Unescape URI path when adding output items |
| TimelineViewModel.cs | Unescape URI path when pasting image elements |
| NodeTreeTabViewModel.cs | Unescape URI paths for state persistence and element matching |
| MainViewModel.cs | Unescape URI path for project name display |
| VideoSourceEditorViewModel.cs | Chain unescaping through reactive properties for file info |
| SoundSourceEditorViewModel.cs | Chain unescaping through reactive properties for file info |
| ImageSourceEditorViewModel.cs | Chain unescaping through reactive properties for file info |
| EditViewModel.cs | Unescape URI paths for view state file operations |
| CreateNewSceneViewModel.cs | Unescape URI path when determining initial location |
| ProjectService.cs | Unescape URI path for recent projects tracking |
| OutputService.cs | Unescape URI paths for profile serialization and file path storage |
| EditorService.cs | Unescape URI paths for file operations and tab management (includes minor formatting changes) |
| RandomFileNameGenerator.cs | Unescape base directory URI path for random filename generation |
| Scene.cs | Unescape URI paths for file synchronization and element management (contains a bug at line 352) |
| VideoSource.cs | Unescape URI path before opening media reader |
| SoundSource.cs | Unescape URI path before opening media reader |
| JsonSerializationContext.Serialize.cs | Unescape URI path when creating file streams |
| CoreSerializer.cs | Unescape URI path when storing objects to disk |
| CoreSerializableJsonConverter.cs | Unescape URI path when creating file streams |
| UriHelper.cs | Unescape URI paths for byte array and stream resolution |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ImmutableArray<TimeRange>.Builder affectedRange | ||
| = ImmutableArray.CreateBuilder<TimeRange>(Math.Max(e.OldItems?.Count ?? 0, e.NewItems?.Count ?? 0)); | ||
|
|
||
| string dirPath = Uri.UnescapeDataString(Uri!.LocalPath); |
Copilot
AI
Dec 5, 2025
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.
Missing Path.GetDirectoryName() call. The dirPath variable should contain a directory path, but this code is assigning the full file path instead. This should be:
string dirPath = Path.GetDirectoryName(Uri.UnescapeDataString(Uri!.LocalPath))!;This bug will cause incorrect path comparisons with Path.GetRelativePath() at lines 359 and 375, leading to wrong behavior when managing element inclusion/exclusion.
| string dirPath = Uri.UnescapeDataString(Uri!.LocalPath); | |
| string dirPath = Path.GetDirectoryName(Uri.UnescapeDataString(Uri!.LocalPath))!; |
Description
Unescape URI paths in various components to correctly handle encoded characters.
Breaking changes
No breaking changes introduced.
Fixed issues
No specific issues fixed.