mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Fix possible exception when extracting zip file
This commit is contained in:
parent
104b4b2680
commit
3e9e91d71c
3 changed files with 30 additions and 3 deletions
|
|
@ -46,6 +46,9 @@
|
||||||
<system:String x:Key="plugin_pluginsmanager_update_all_success_no_restart">{0} plugins successfully updated. Please restart Flow.</system:String>
|
<system:String x:Key="plugin_pluginsmanager_update_all_success_no_restart">{0} plugins successfully updated. Please restart Flow.</system:String>
|
||||||
<system:String x:Key="plugin_pluginsmanager_plugin_modified_error">Plugin {0} has already been modified. Please restart Flow before making any further changes.</system:String>
|
<system:String x:Key="plugin_pluginsmanager_plugin_modified_error">Plugin {0} has already been modified. Please restart Flow before making any further changes.</system:String>
|
||||||
|
|
||||||
|
<system:String x:Key="plugin_pluginsmanager_invalid_zip_title">Invalid zip installer file</system:String>
|
||||||
|
<system:String x:Key="plugin_pluginsmanager_invalid_zip_subtitle">Please check if there is plugin.json in {0}</system:String>
|
||||||
|
|
||||||
<!-- Plugin Infos -->
|
<!-- Plugin Infos -->
|
||||||
<system:String x:Key="plugin_pluginsmanager_plugin_name">Plugins Manager</system:String>
|
<system:String x:Key="plugin_pluginsmanager_plugin_name">Plugins Manager</system:String>
|
||||||
<system:String x:Key="plugin_pluginsmanager_plugin_description">Management of installing, uninstalling or updating Flow Launcher plugins</system:String>
|
<system:String x:Key="plugin_pluginsmanager_plugin_description">Management of installing, uninstalling or updating Flow Launcher plugins</system:String>
|
||||||
|
|
|
||||||
|
|
@ -242,6 +242,18 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
||||||
if (FilesFolders.IsZipFilePath(search, checkFileExists: true))
|
if (FilesFolders.IsZipFilePath(search, checkFileExists: true))
|
||||||
{
|
{
|
||||||
pluginFromLocalPath = Utilities.GetPluginInfoFromZip(search);
|
pluginFromLocalPath = Utilities.GetPluginInfoFromZip(search);
|
||||||
|
|
||||||
|
if (pluginFromLocalPath == null) return new List<Result>
|
||||||
|
{
|
||||||
|
new()
|
||||||
|
{
|
||||||
|
Title = Context.API.GetTranslation("plugin_pluginsmanager_invalid_zip_title"),
|
||||||
|
SubTitle = string.Format(Context.API.GetTranslation("plugin_pluginsmanager_invalid_zip_subtitle"),
|
||||||
|
search),
|
||||||
|
IcoPath = icoPath
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
pluginFromLocalPath.LocalInstallPath = search;
|
pluginFromLocalPath.LocalInstallPath = search;
|
||||||
updateFromLocalPath = true;
|
updateFromLocalPath = true;
|
||||||
}
|
}
|
||||||
|
|
@ -559,6 +571,20 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
||||||
{
|
{
|
||||||
var plugin = Utilities.GetPluginInfoFromZip(localPath);
|
var plugin = Utilities.GetPluginInfoFromZip(localPath);
|
||||||
|
|
||||||
|
if (plugin == null)
|
||||||
|
{
|
||||||
|
return new List<Result>
|
||||||
|
{
|
||||||
|
new()
|
||||||
|
{
|
||||||
|
Title = Context.API.GetTranslation("plugin_pluginsmanager_invalid_zip_title"),
|
||||||
|
SubTitle = string.Format(Context.API.GetTranslation("plugin_pluginsmanager_invalid_zip_subtitle"),
|
||||||
|
localPath),
|
||||||
|
IcoPath = icoPath
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
plugin.LocalInstallPath = localPath;
|
plugin.LocalInstallPath = localPath;
|
||||||
|
|
||||||
return new List<Result>
|
return new List<Result>
|
||||||
|
|
|
||||||
|
|
@ -65,9 +65,7 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
||||||
|
|
||||||
using (ZipArchive archive = System.IO.Compression.ZipFile.OpenRead(filePath))
|
using (ZipArchive archive = System.IO.Compression.ZipFile.OpenRead(filePath))
|
||||||
{
|
{
|
||||||
var pluginJsonPath = archive.Entries.FirstOrDefault(x => x.Name == "plugin.json").ToString();
|
var pluginJsonEntry = archive.Entries.FirstOrDefault(x => x.Name == "plugin.json");
|
||||||
ZipArchiveEntry pluginJsonEntry = archive.GetEntry(pluginJsonPath);
|
|
||||||
|
|
||||||
if (pluginJsonEntry != null)
|
if (pluginJsonEntry != null)
|
||||||
{
|
{
|
||||||
using Stream stream = pluginJsonEntry.Open();
|
using Stream stream = pluginJsonEntry.Open();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue