Gracefully handle corrupt plugin zips
This commit is contained in:
@@ -206,6 +206,8 @@ namespace Torch.Managers
|
|||||||
PluginsLoaded?.Invoke(_plugins.Values.AsReadOnly());
|
PluginsLoaded?.Invoke(_plugins.Values.AsReadOnly());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//debug flag is set when the user asks us to run with a specific plugin for plugin development debug
|
||||||
|
//please do not change references to this arg unless you are very sure you know what you're doing
|
||||||
private List<PluginItem> GetLocalPlugins(string pluginDir, bool debug = false)
|
private List<PluginItem> GetLocalPlugins(string pluginDir, bool debug = false)
|
||||||
{
|
{
|
||||||
var firstLoad = Torch.Config.Plugins.Count == 0;
|
var firstLoad = Torch.Config.Plugins.Count == 0;
|
||||||
@@ -504,6 +506,8 @@ namespace Torch.Managers
|
|||||||
}
|
}
|
||||||
|
|
||||||
private PluginManifest GetManifestFromZip(string path)
|
private PluginManifest GetManifestFromZip(string path)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
using (var zipFile = ZipFile.OpenRead(path))
|
using (var zipFile = ZipFile.OpenRead(path))
|
||||||
{
|
{
|
||||||
@@ -518,6 +522,12 @@ namespace Torch.Managers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_log.Error(ex, $"Error opening zip! File is likely corrupt. File at {path} will be deleted and re-acquired on the next restart!");
|
||||||
|
File.Delete(path);
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user