mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +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
|
|
@ -2862,8 +2862,8 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
return true;
|
||||
|
||||
return hasSearchString && !(
|
||||
manifest.Name.ToLowerInvariant().Contains(searchString) ||
|
||||
manifest.InternalName.ToLowerInvariant().Contains(searchString) ||
|
||||
(!manifest.Name.IsNullOrEmpty() && manifest.Name.ToLowerInvariant().Contains(searchString)) ||
|
||||
(!manifest.InternalName.IsNullOrEmpty() && manifest.InternalName.ToLowerInvariant().Contains(searchString)) ||
|
||||
(!manifest.Author.IsNullOrEmpty() && manifest.Author.Equals(this.searchText, StringComparison.InvariantCultureIgnoreCase)) ||
|
||||
(!manifest.Punchline.IsNullOrEmpty() && manifest.Punchline.ToLowerInvariant().Contains(searchString)) ||
|
||||
(manifest.Tags != null && manifest.Tags.Any(tag => tag.ToLowerInvariant().Contains(searchString))));
|
||||
|
|
|
|||
|
|
@ -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