From 4bcad9b76ba273db88f380a7548bf3cc773c9dd6 Mon Sep 17 00:00:00 2001 From: Pat Hartl Date: Sat, 14 Jan 2023 16:11:28 -0600 Subject: [PATCH] Fix download request failing to download if route provided starts with a / --- LANCommander.Playnite.Extension/LANCommanderClient.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/LANCommander.Playnite.Extension/LANCommanderClient.cs b/LANCommander.Playnite.Extension/LANCommanderClient.cs index 8019039..55833a8 100644 --- a/LANCommander.Playnite.Extension/LANCommanderClient.cs +++ b/LANCommander.Playnite.Extension/LANCommanderClient.cs @@ -46,6 +46,8 @@ namespace LANCommander.PlaynitePlugin private string DownloadRequest(string route, Action progressHandler, Action completeHandler) { + route = route.TrimStart('/'); + var client = new WebClient(); var tempFile = Path.GetTempFileName(); @@ -53,9 +55,6 @@ namespace LANCommander.PlaynitePlugin client.DownloadProgressChanged += (s, e) => progressHandler(e); client.DownloadFileCompleted += (s, e) => completeHandler(e); - var request = new RestRequest(route) - .AddHeader("Authorization", $"Bearer {Token.AccessToken}"); - client.DownloadFileAsync(new Uri($"{Client.BaseUrl}{route}"), tempFile); return tempFile; @@ -128,7 +127,7 @@ namespace LANCommander.PlaynitePlugin public string DownloadArchive(Guid id, Action progressHandler, Action completeHandler) { - return DownloadRequest($"api/Archives/Download/{id}", progressHandler, completeHandler); + return DownloadRequest($"/api/Archives/Download/{id}", progressHandler, completeHandler); } } }