Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mohnjiles committed Nov 21, 2023
2 parents 9708919 + baf9458 commit c1901b7
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 c1901b7

Please sign in to comment.