mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-13 02:39:22 +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.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using Wox.Infrastructure;
|
using Wox.Infrastructure;
|
||||||
@ -255,6 +256,7 @@ namespace Microsoft.Plugin.Folder
|
|||||||
var firstResult = "Open " + search;
|
var firstResult = "Open " + search;
|
||||||
|
|
||||||
var folderName = search.TrimEnd('\\').Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.None).Last();
|
var folderName = search.TrimEnd('\\').Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.None).Last();
|
||||||
|
var sanitizedPath = Regex.Replace(search, @"[\/\\]+", "\\");
|
||||||
|
|
||||||
return new Result
|
return new Result
|
||||||
{
|
{
|
||||||
@ -265,7 +267,7 @@ namespace Microsoft.Plugin.Folder
|
|||||||
Score = 500,
|
Score = 500,
|
||||||
Action = c =>
|
Action = c =>
|
||||||
{
|
{
|
||||||
Process.Start(_fileExplorerProgramName, search);
|
Process.Start(_fileExplorerProgramName, sanitizedPath);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user