mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-29 08:29:10 +01:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aac430c25c | ||
|
|
5bcdbbcb44 | ||
|
|
b60940312a |
@@ -78,6 +78,7 @@ namespace Microsoft.Plugin.Uri.UnitTests.UriHelper
|
||||
[DataRow("ftp://user:password@google.com:2121", true, "ftp://user:password@google.com:2121/", false)]
|
||||
[DataRow("ftp://user:password@1.1.1.1", true, "ftp://user:password@1.1.1.1/", false)]
|
||||
[DataRow("ftp://user:password@1.1.1.1:2121", true, "ftp://user:password@1.1.1.1:2121/", false)]
|
||||
[DataRow("^:", false, null, false)]
|
||||
|
||||
public void TryParseCanParseHostName(string query, bool expectedSuccess, string expectedResult, bool expectedIsWebUri)
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using Microsoft.Plugin.Uri.Interfaces;
|
||||
|
||||
namespace Microsoft.Plugin.Uri.UriHelper
|
||||
@@ -21,10 +22,13 @@ namespace Microsoft.Plugin.Uri.UriHelper
|
||||
|
||||
// Handling URL with only scheme, typically mailto or application uri.
|
||||
// Do nothing, return the result without urlBuilder
|
||||
// And check if scheme match REC3986 (issue #15035)
|
||||
const string schemeRegex = @"^([a-z][a-z0-9+\-.]*):";
|
||||
if (input.EndsWith(":", StringComparison.OrdinalIgnoreCase)
|
||||
&& !input.StartsWith("http", StringComparison.OrdinalIgnoreCase)
|
||||
&& !input.Contains("/", StringComparison.OrdinalIgnoreCase)
|
||||
&& !input.All(char.IsDigit))
|
||||
&& !input.All(char.IsDigit)
|
||||
&& Regex.IsMatch(input, schemeRegex))
|
||||
{
|
||||
result = new System.Uri(input);
|
||||
isWebUri = false;
|
||||
|
||||
@@ -9,6 +9,10 @@ namespace PowerLauncher.Telemetry.Events
|
||||
[EventData]
|
||||
public class PluginModel
|
||||
{
|
||||
public string ID { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public bool Disabled { get; set; }
|
||||
|
||||
public bool IsGlobal { get; set; }
|
||||
|
||||
@@ -52,16 +52,27 @@ namespace PowerLauncher
|
||||
|
||||
private void SendSettingsTelemetry()
|
||||
{
|
||||
Log.Info("Send Run settings telemetry", this.GetType());
|
||||
var plugins = PluginManager.AllPlugins.ToDictionary(x => x.Metadata.Name, x => new PluginModel()
|
||||
try
|
||||
{
|
||||
Disabled = x.Metadata.Disabled,
|
||||
ActionKeyword = x.Metadata.ActionKeyword,
|
||||
IsGlobal = x.Metadata.IsGlobal,
|
||||
});
|
||||
Log.Info("Send Run settings telemetry", this.GetType());
|
||||
var plugins = PluginManager.AllPlugins.ToDictionary(x => x.Metadata.Name + " " + x.Metadata.ID, x => new PluginModel()
|
||||
{
|
||||
ID = x.Metadata.ID,
|
||||
Name = x.Metadata.Name,
|
||||
Disabled = x.Metadata.Disabled,
|
||||
ActionKeyword = x.Metadata.ActionKeyword,
|
||||
IsGlobal = x.Metadata.IsGlobal,
|
||||
});
|
||||
|
||||
var telemetryEvent = new RunPluginsSettingsEvent(plugins);
|
||||
PowerToysTelemetry.Log.WriteEvent(telemetryEvent);
|
||||
var telemetryEvent = new RunPluginsSettingsEvent(plugins);
|
||||
PowerToysTelemetry.Log.WriteEvent(telemetryEvent);
|
||||
}
|
||||
#pragma warning disable CA1031 // Do not catch general exception types
|
||||
catch (Exception ex)
|
||||
#pragma warning restore CA1031 // Do not catch general exception types
|
||||
{
|
||||
Log.Exception("Unhandled exception when trying to send PowerToys Run settings telemetry.", ex, GetType());
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnSourceInitialized(EventArgs e)
|
||||
|
||||
@@ -174,7 +174,6 @@
|
||||
Padding="0, 0"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||
ScrollViewer.CanContentScroll="False"
|
||||
SelectionMode="Single"
|
||||
SelectedIndex="{Binding Results.SelectedIndex, Mode=TwoWay}"
|
||||
SelectionChanged="SuggestionsListView_SelectionChanged"
|
||||
|
||||
Reference in New Issue
Block a user