Fix download request failing to download if route provided starts with a /
parent
98062e3f37
commit
4bcad9b76b
|
@ -46,6 +46,8 @@ namespace LANCommander.PlaynitePlugin
|
|||
|
||||
private string DownloadRequest(string route, Action<DownloadProgressChangedEventArgs> progressHandler, Action<AsyncCompletedEventArgs> 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<DownloadProgressChangedEventArgs> progressHandler, Action<AsyncCompletedEventArgs> completeHandler)
|
||||
{
|
||||
return DownloadRequest($"api/Archives/Download/{id}", progressHandler, completeHandler);
|
||||
return DownloadRequest($"/api/Archives/Download/{id}", progressHandler, completeHandler);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue