Compare commits

...

3 Commits

Author SHA1 Message Date
Jaime Bernardo
aac430c25c [PTRun]Fix crash when plugins have the same name (#15456) 2022-01-11 23:11:53 +00:00
Franky Chen
5bcdbbcb44 [PT Run] Add scheme verification for application URI (#15324)
* [PT Run] Add scheme verfication for application URI

* Add test
2022-01-11 16:12:24 +00:00
Jaime Bernardo
b60940312a Revert "[PT Run] Smooth scrolling of the results list" (#15420)
This reverts commit 3ada3c20a2.
2022-01-11 16:11:42 +00:00
5 changed files with 29 additions and 10 deletions

View File

@@ -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)
{

View File

@@ -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;

View File

@@ -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; }

View File

@@ -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)

View File

@@ -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"