Skip to content

Conversation

@yuto-trd
Copy link
Member

@yuto-trd yuto-trd commented Dec 5, 2025

Description

Unescape URI paths in various components to correctly handle encoded characters.

Breaking changes

No breaking changes introduced.

Fixed issues

No specific issues fixed.

Copilot AI review requested due to automatic review settings December 5, 2025 18:27
@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2025

No TODO comments were found.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2025

Code Coverage

Package Line Rate Branch Rate Complexity Health
Beutl.Operators 4% 0% 76
Beutl.Core 34% 31% 3142
Beutl.Engine 27% 24% 9789
Beutl.Threading 99% 90% 118
Beutl.Utilities 73% 67% 358
Beutl.Configuration 38% 19% 282
Beutl.Extensibility 2% 0% 105
Beutl.ProjectSystem 16% 10% 1852
Beutl.Language 0% 0% 656
Summary 27% (10550 / 39053) 25% (2804 / 11039) 16378

Minimum allowed line rate is 0%

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 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 all Uri.LocalPath accesses 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);
Copy link

Copilot AI Dec 5, 2025

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.

Suggested change
string dirPath = Uri.UnescapeDataString(Uri!.LocalPath);
string dirPath = Path.GetDirectoryName(Uri.UnescapeDataString(Uri!.LocalPath))!;

Copilot uses AI. Check for mistakes.
@yuto-trd yuto-trd merged commit 5d35d43 into main Dec 5, 2025
10 checks passed
@yuto-trd yuto-trd deleted the fix/unescaped-uri branch December 5, 2025 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants