mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-04 03:49:07 +08:00
Added code to sanitize folder path (#2673)
This commit is contained in:
parent
64c17767ed
commit
67b2f28064
@ -4,6 +4,7 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using Wox.Infrastructure;
|
||||
@ -255,6 +256,7 @@ namespace Microsoft.Plugin.Folder
|
||||
var firstResult = "Open " + search;
|
||||
|
||||
var folderName = search.TrimEnd('\\').Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.None).Last();
|
||||
var sanitizedPath = Regex.Replace(search, @"[\/\\]+", "\\");
|
||||
|
||||
return new Result
|
||||
{
|
||||
@ -265,7 +267,7 @@ namespace Microsoft.Plugin.Folder
|
||||
Score = 500,
|
||||
Action = c =>
|
||||
{
|
||||
Process.Start(_fileExplorerProgramName, search);
|
||||
Process.Start(_fileExplorerProgramName, sanitizedPath);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user