From 686f33982df1414d062892e408318b81c0fcf0bf Mon Sep 17 00:00:00 2001 From: Chris Kaczor Date: Fri, 6 Apr 2018 10:29:05 -0400 Subject: [PATCH] Fix update download when using GitHub --- Update/UpdateCheck.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Update/UpdateCheck.cs b/Update/UpdateCheck.cs index d0f94c0..c921c50 100644 --- a/Update/UpdateCheck.cs +++ b/Update/UpdateCheck.cs @@ -2,6 +2,7 @@ using System; using System.Diagnostics; using System.IO; +using System.Linq; using System.Net; using System.Reflection; using System.Threading.Tasks; @@ -55,13 +56,15 @@ namespace Common.Update if (RemoteVersion == null) return false; - var remoteFile = UpdateServer + RemoteVersion.InstallFile; + var remoteFile = UpdateServerType == ServerType.GitHub ? RemoteVersion.InstallFile : UpdateServer + RemoteVersion.InstallFile; - LocalInstallFile = Path.Combine(Path.GetTempPath(), RemoteVersion.InstallFile); + var remoteUri = new Uri(remoteFile); + + LocalInstallFile = Path.Combine(Path.GetTempPath(), remoteUri.Segments.Last()); var webClient = new WebClient(); - await webClient.DownloadFileTaskAsync(new Uri(remoteFile), LocalInstallFile); + await webClient.DownloadFileTaskAsync(remoteUri, LocalInstallFile); return true; }