mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 11:34:57 +02:00
fix version comparison
This commit is contained in:
parent
510fbf139c
commit
ae331babed
1 changed files with 20 additions and 12 deletions
|
@ -66,29 +66,23 @@ namespace MediaBrowser.Server.Startup.Common.Migrations
|
|||
if (releases.Count >= 1)
|
||||
{
|
||||
var release = releases[0];
|
||||
Version version;
|
||||
if (Version.TryParse(release.tag_name, out version))
|
||||
{
|
||||
if (currentVersion > version)
|
||||
var version = ParseVersion(release.tag_name);
|
||||
if (version != null && currentVersion > version)
|
||||
{
|
||||
newUpdateLevel = PackageVersionClass.Beta;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If the current version is later than current beta, set the update level to dev
|
||||
if (releases.Count >= 2)
|
||||
{
|
||||
var release = releases[1];
|
||||
Version version;
|
||||
if (Version.TryParse(release.tag_name, out version))
|
||||
{
|
||||
if (currentVersion > version)
|
||||
var version = ParseVersion(release.tag_name);
|
||||
if (version != null && currentVersion > version)
|
||||
{
|
||||
newUpdateLevel = PackageVersionClass.Dev;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (newUpdateLevel != updateLevel)
|
||||
{
|
||||
|
@ -96,5 +90,19 @@ namespace MediaBrowser.Server.Startup.Common.Migrations
|
|||
_config.SaveConfiguration();
|
||||
}
|
||||
}
|
||||
|
||||
private Version ParseVersion(string versionString)
|
||||
{
|
||||
var parts = versionString.Split('.');
|
||||
if (parts.Length == 3)
|
||||
{
|
||||
versionString += ".0";
|
||||
}
|
||||
|
||||
Version version;
|
||||
Version.TryParse(versionString, out version);
|
||||
|
||||
return version;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue