mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-11-27 14:59:16 +08:00
[RegistryPreview]Fix opening non-ascii filenames and spaces around assignments (#28786)
* BugFixes Fixes for #26029 and #28147 * Adding fix for 28820
This commit is contained in:
parent
2d3e11a707
commit
898644f6f6
@ -55,6 +55,12 @@ namespace RegistryPreview
|
||||
resourceLoader.GetString("YesNoCancelDialogCloseButtonText"));
|
||||
}
|
||||
|
||||
// Check to see if the textbox's context menu is open
|
||||
if (textBox.ContextFlyout != null && textBox.ContextFlyout.IsOpen)
|
||||
{
|
||||
textBox.ContextFlyout.Hide();
|
||||
}
|
||||
|
||||
// Save window placement
|
||||
SaveWindowPlacementFile(settingsFolder, windowPlacementFile);
|
||||
}
|
||||
|
@ -292,13 +292,20 @@ namespace RegistryPreview
|
||||
|
||||
// set the name and the value
|
||||
string name = registryLine.Substring(0, equal);
|
||||
|
||||
// trim the whitespace and quotes from the name
|
||||
name = name.Trim();
|
||||
name = StripFirstAndLast(name);
|
||||
|
||||
// Clean out any escaped characters in the value, only for the preview
|
||||
name = StripEscapedCharacters(name);
|
||||
|
||||
// set the value
|
||||
string value = registryLine.Substring(equal + 1);
|
||||
|
||||
// trim the whitespace from the value
|
||||
value = value.Trim();
|
||||
|
||||
// Create a new listview item that will be used to display the value
|
||||
registryValue = new RegistryValue(name, "REG_SZ", string.Empty);
|
||||
|
||||
@ -1028,8 +1035,11 @@ namespace RegistryPreview
|
||||
|
||||
try
|
||||
{
|
||||
fileContents = jsonWindowPlacement.Stringify();
|
||||
await Windows.Storage.FileIO.WriteTextAsync(storageFile, fileContents);
|
||||
if (jsonWindowPlacement != null)
|
||||
{
|
||||
fileContents = jsonWindowPlacement.Stringify();
|
||||
await Windows.Storage.FileIO.WriteTextAsync(storageFile, fileContents);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -5,6 +5,7 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Web;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.Windows.AppLifecycle;
|
||||
using Windows.ApplicationModel.Activation;
|
||||
@ -52,6 +53,20 @@ namespace RegistryPreview
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (activatedArgs.Kind == ExtendedActivationKind.Protocol)
|
||||
{
|
||||
// When the app is the default handler for REG files and the filename has non-ASCII characters, the app gets activated by Protocol
|
||||
AppFilename = string.Empty;
|
||||
if (activatedArgs.Data != null)
|
||||
{
|
||||
IProtocolActivatedEventArgs eventArgs = (IProtocolActivatedEventArgs)activatedArgs.Data;
|
||||
if (eventArgs.Uri.AbsoluteUri.Length > 0)
|
||||
{
|
||||
AppFilename = eventArgs.Uri.Query.Replace("?ContractId=Windows.File&Verb=open&File=", string.Empty);
|
||||
AppFilename = HttpUtility.UrlDecode(AppFilename);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Right click on a REG file and selected Preview
|
||||
|
Loading…
Reference in New Issue
Block a user