Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix potential parse error in UpdateManager #12685

Merged
merged 2 commits into from
Mar 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions WalletWasabi/Services/UpdateManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,10 @@ private async Task<(Version LatestVersion, string InstallerDownloadUrl, string I

string softwareVersion = jsonResponse["tag_name"]?.ToString() ?? throw new InvalidDataException("Endpoint gave back wrong json data or it's changed.");

// "tag_name" will have a 'v' at the beginning, needs to be removed.
Version githubVersion = new(softwareVersion[1..]);
// Make sure there are no non-numeric characters (besides '.') in the version string.
softwareVersion = string.Concat(softwareVersion.Where(c => char.IsDigit(c) || c == '.').ToArray());

Version githubVersion = new(softwareVersion);
Version shortGithubVersion = new(githubVersion.Major, githubVersion.Minor, githubVersion.Build);
if (targetVersion != shortGithubVersion)
{
Expand Down