remove soft GitHub lookups during update checks (#651)

This caused incorrect update alerts for repositories that contain multiple mods but still use releases.
This commit is contained in:
Jesse Plamondon-Willard 2019-07-30 14:21:18 -04:00
parent 4bb644e46e
commit b802471dd4
No known key found for this signature in database
GPG Key ID: CF8B1456B3E29F49
1 changed files with 2 additions and 9 deletions

View File

@ -125,18 +125,11 @@ namespace StardewModdingAPI.Web.Controllers
WikiModEntry wikiEntry = wikiData.FirstOrDefault(entry => entry.ID.Contains(search.ID.Trim(), StringComparer.InvariantCultureIgnoreCase));
UpdateKey[] updateKeys = this.GetUpdateKeys(search.UpdateKeys, record, wikiEntry).ToArray();
// add soft lookups (don't log errors if the target doesn't exist)
UpdateKey[] softUpdateKeys = updateKeys.All(key => key.Repository != ModRepositoryKey.GitHub) && !string.IsNullOrWhiteSpace(wikiEntry?.GitHubRepo)
? new[] { new UpdateKey(ModRepositoryKey.GitHub, wikiEntry.GitHubRepo) }
: new UpdateKey[0];
// get latest versions
ModEntryModel result = new ModEntryModel { ID = search.ID };
IList<string> errors = new List<string>();
foreach (UpdateKey updateKey in updateKeys.Concat(softUpdateKeys))
foreach (UpdateKey updateKey in updateKeys)
{
bool isSoftLookup = softUpdateKeys.Contains(updateKey);
// validate update key
if (!updateKey.LooksValid)
{
@ -148,7 +141,7 @@ namespace StardewModdingAPI.Web.Controllers
ModInfoModel data = await this.GetInfoForUpdateKeyAsync(updateKey);
if (data.Error != null)
{
if (!isSoftLookup || data.Status != RemoteModStatus.DoesNotExist)
if (data.Status != RemoteModStatus.DoesNotExist)
errors.Add(data.Error);
continue;
}