fix: OpenFolderPickerAsync raise exception when selected a drive root such as E:\

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2025-05-30 17:12:56 +08:00
parent 1bd2044589
commit bc5deac9fe
No known key found for this signature in database
8 changed files with 32 additions and 9 deletions

View file

@ -452,7 +452,9 @@ namespace SourceGit.ViewModels
var selected = await storageProvider.OpenFolderPickerAsync(options);
if (selected.Count == 1)
{
var saveTo = Path.Combine(selected[0].Path.LocalPath, Path.GetFileName(file.Path));
var folder = selected[0];
var folderPath = folder is { Path: { IsAbsoluteUri: true } path } ? path.LocalPath : folder?.Path.ToString();
var saveTo = Path.Combine(folderPath, Path.GetFileName(file.Path));
Commands.SaveRevisionFile.Run(_repo.FullPath, _commit.SHA, file.Path, saveTo);
}
}