mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-01-02 13:53:40 +01:00
fix: correctly handle plugins with invalid Name,InternalName,AssemblyVersion
This commit is contained in:
parent
f1dfaa92c9
commit
c1f10b21b3
2 changed files with 28 additions and 3 deletions
|
|
@ -10,6 +10,7 @@ using System.Threading.Tasks;
|
|||
|
||||
using Dalamud.Logging.Internal;
|
||||
using Dalamud.Networking.Http;
|
||||
using Dalamud.Utility;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Dalamud.Plugin.Internal.Types;
|
||||
|
|
@ -145,7 +146,7 @@ internal class PluginRepository
|
|||
return;
|
||||
}
|
||||
|
||||
this.PluginMaster = pluginMaster.AsReadOnly();
|
||||
this.PluginMaster = pluginMaster.Where(this.IsValidManifest).ToList().AsReadOnly();
|
||||
|
||||
Log.Information($"Successfully fetched repo: {this.PluginMasterUrl}");
|
||||
this.State = PluginRepositoryState.Success;
|
||||
|
|
@ -156,4 +157,28 @@ internal class PluginRepository
|
|||
this.State = PluginRepositoryState.Fail;
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsValidManifest(RemotePluginManifest manifest)
|
||||
{
|
||||
if (manifest.InternalName.IsNullOrWhitespace())
|
||||
{
|
||||
Log.Error("Repository at {RepoLink} has a plugin with an invalid InternalName.", this.PluginMasterUrl);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (manifest.Name.IsNullOrWhitespace())
|
||||
{
|
||||
Log.Error("Plugin {PluginName} in {RepoLink} has an invalid Name.", manifest.InternalName, this.PluginMasterUrl);
|
||||
return false;
|
||||
}
|
||||
|
||||
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
||||
if (manifest.AssemblyVersion == null)
|
||||
{
|
||||
Log.Error("Plugin {PluginName} in {RepoLink} has an invalid AssemblyVersion.", manifest.InternalName, this.PluginMasterUrl);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue