mirror of
https://github.com/RPCS3/discord-bot.git
synced 2026-01-31 01:25:22 +01:00
apparently commit hashes in filenames and in log could have different prefix length
This commit is contained in:
committed by
Roberto Anić Banić
parent
311e9dd683
commit
a4c24e516e
@@ -212,10 +212,22 @@ namespace CompatBot.Utils.ResultFormatters
|
||||
return null;
|
||||
|
||||
var latestBuildInfo = BuildInfoInUpdate.Match(link.ToLowerInvariant());
|
||||
if (!latestBuildInfo.Success || buildInfo.Groups["commit"].Value == latestBuildInfo.Groups["commit"].Value)
|
||||
if (!latestBuildInfo.Success || SameCommits(buildInfo.Groups["commit"].Value, latestBuildInfo.Groups["commit"].Value))
|
||||
return null;
|
||||
|
||||
return updateInfo;
|
||||
}
|
||||
|
||||
private static bool SameCommits(string commitA, string CommitB)
|
||||
{
|
||||
if (string.IsNullOrEmpty(commitA) && string.IsNullOrEmpty(CommitB))
|
||||
return true;
|
||||
|
||||
if (string.IsNullOrEmpty(commitA) || string.IsNullOrEmpty(CommitB))
|
||||
return false;
|
||||
|
||||
var len = Math.Min(commitA.Length, CommitB.Length);
|
||||
return commitA.Substring(0, len) == CommitB.Substring(0, len);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user