From 11228356888409abc80d1a45dcacf737dcf17313 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 30 Sep 2017 15:51:55 -0400 Subject: [PATCH] 3.2.32.14 --- MediaBrowser.Common/Updates/GithubUpdater.cs | 24 ++++++++++++++++---- SharedVersion.cs | 2 +- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/MediaBrowser.Common/Updates/GithubUpdater.cs b/MediaBrowser.Common/Updates/GithubUpdater.cs index cc83e7c6e0..2106ac6d52 100644 --- a/MediaBrowser.Common/Updates/GithubUpdater.cs +++ b/MediaBrowser.Common/Updates/GithubUpdater.cs @@ -114,7 +114,7 @@ namespace MediaBrowser.Common.Updates { var obj = _jsonSerializer.DeserializeFromStream(stream); - obj = obj.Where(i => (i.assets ?? new List()).Any(a => IsAsset(a, assetFilename))).ToArray(); + obj = obj.Where(i => (i.assets ?? new List()).Any(a => IsAsset(a, assetFilename, i.tag_name))).ToArray(); list.AddRange(obj.Where(i => MatchesUpdateLevel(i, PackageVersionClass.Release)).OrderByDescending(GetVersion).Take(1)); list.AddRange(obj.Where(i => MatchesUpdateLevel(i, PackageVersionClass.Beta)).OrderByDescending(GetVersion).Take(1)); @@ -138,7 +138,8 @@ namespace MediaBrowser.Common.Updates private CheckForUpdateResult CheckForUpdateResult(RootObject obj, Version minVersion, string assetFilename, string packageName, string targetFilename) { Version version; - if (!Version.TryParse(obj.tag_name, out version)) + var versionString = obj.tag_name; + if (!Version.TryParse(versionString, out version)) { return null; } @@ -148,7 +149,7 @@ namespace MediaBrowser.Common.Updates return null; } - var asset = (obj.assets ?? new List()).FirstOrDefault(i => IsAsset(i, assetFilename)); + var asset = (obj.assets ?? new List()).FirstOrDefault(i => IsAsset(i, assetFilename, versionString)); if (asset == null) { @@ -175,9 +176,22 @@ namespace MediaBrowser.Common.Updates }; } - private bool IsAsset(Asset asset, string assetFilename) + private bool IsAsset(Asset asset, string assetFilename, string version) { - var downloadFilename = Path.GetFileName(asset.browser_download_url) ?? string.Empty; + var downloadFilename = Path.GetFileNameWithoutExtension(asset.browser_download_url) ?? string.Empty; + var assetExtension = Path.GetExtension(assetFilename); + + assetFilename = assetFilename.Replace("{version}", version); + assetFilename = Path.GetFileNameWithoutExtension(assetFilename); + + var zipExtensions = new[] { ".zip", ".7z" }; + var extensionMatch = zipExtensions.Contains(Path.GetExtension(asset.browser_download_url) ?? string.Empty, StringComparer.OrdinalIgnoreCase) && + zipExtensions.Contains(assetExtension ?? string.Empty, StringComparer.OrdinalIgnoreCase); + + if (!extensionMatch) + { + return false; + } if (downloadFilename.IndexOf(assetFilename, StringComparison.OrdinalIgnoreCase) != -1) { diff --git a/SharedVersion.cs b/SharedVersion.cs index 60c2338f6b..7ada92fdf6 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -1,3 +1,3 @@ using System.Reflection; -[assembly: AssemblyVersion("3.2.32.13")] +[assembly: AssemblyVersion("3.2.32.14")]