Skip to content

Commit

Permalink
Merge pull request #357 from ionite34/fix-update-check
Browse files Browse the repository at this point in the history
  • Loading branch information
ionite34 authored Nov 21, 2023
2 parents d007c5d + e4719e9 commit baf9458
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion StabilityMatrix.Core/Updater/UpdateHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,11 @@ await response.Content.ReadAsStreamAsync().ConfigureAwait(false),
foreach (
var channel in Enum.GetValues(typeof(UpdateChannel))
.Cast<UpdateChannel>()
.Where(c => c > UpdateChannel.Unknown)
.Where(
c =>
c > UpdateChannel.Unknown
&& c <= settingsManager.Settings.PreferredUpdateChannel
)
)
{
if (
Expand Down Expand Up @@ -202,6 +206,12 @@ private bool ValidateUpdate(UpdateInfo? update)
// Same version available, check if we both have commit hash metadata
var updateHash = update.Version.Metadata;
var appHash = Compat.AppVersion.Metadata;

// Trim both to the lower length, to a minimum of 7 characters
var minLength = Math.Min(7, Math.Min(updateHash.Length, appHash.Length));
updateHash = updateHash[..minLength];
appHash = appHash[..minLength];

// If different, we can update
if (updateHash != appHash)
{
Expand Down

0 comments on commit baf9458

Please sign in to comment.