mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-06-07 09:28:03 +08:00
Don't crash if URI can't be parsed (#11788)
This commit is contained in:
parent
70b9c0f879
commit
735accc1a8
@ -6,6 +6,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Microsoft.Search.Interop;
|
using Microsoft.Search.Interop;
|
||||||
|
using Wox.Plugin.Logger;
|
||||||
|
|
||||||
namespace Microsoft.Plugin.Indexer.SearchHelper
|
namespace Microsoft.Plugin.Indexer.SearchHelper
|
||||||
{
|
{
|
||||||
@ -49,7 +50,12 @@ namespace Microsoft.Plugin.Indexer.SearchHelper
|
|||||||
// # is URI syntax for the fragment component, need to be encoded so LocalPath returns complete path
|
// # is URI syntax for the fragment component, need to be encoded so LocalPath returns complete path
|
||||||
// Using OrdinalIgnoreCase since this is internal and used with symbols
|
// Using OrdinalIgnoreCase since this is internal and used with symbols
|
||||||
var string_path = ((string)oleDBResult.FieldData[0]).Replace("#", "%23", StringComparison.OrdinalIgnoreCase);
|
var string_path = ((string)oleDBResult.FieldData[0]).Replace("#", "%23", StringComparison.OrdinalIgnoreCase);
|
||||||
var uri_path = new Uri(string_path);
|
|
||||||
|
if (!Uri.TryCreate(string_path, UriKind.RelativeOrAbsolute, out Uri uri_path))
|
||||||
|
{
|
||||||
|
Log.Warn($"Failed to parse URI '${string_path}'", typeof(WindowsSearchAPI));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
var result = new SearchResult
|
var result = new SearchResult
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user