Update DownloadAndUpdateClientAction to not prepend param name when downloading

Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com>
This commit is contained in:
Danilo Del Busso 2023-04-12 08:43:42 +01:00
parent 1b3b4b218d
commit 7b18b3b105
No known key found for this signature in database

View File

@ -29,7 +29,6 @@
*/ */
using System; using System;
using System.Collections.Specialized;
using System.ComponentModel; using System.ComponentModel;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
@ -37,6 +36,7 @@ using System.Net;
using System.Net.NetworkInformation; using System.Net.NetworkInformation;
using System.Security.Cryptography.X509Certificates; using System.Security.Cryptography.X509Certificates;
using System.Threading; using System.Threading;
using XenAdmin.Core;
using XenCenterLib; using XenCenterLib;
namespace XenAdmin.Actions.Updates namespace XenAdmin.Actions.Updates
@ -105,13 +105,17 @@ namespace XenAdmin.Actions.Updates
//start the download //start the download
_updateDownloadState = DownloadState.InProgress; _updateDownloadState = DownloadState.InProgress;
var uriBuilder = new UriBuilder(_address);
if (!string.IsNullOrEmpty(_authToken)) if (!string.IsNullOrEmpty(_authToken))
{ {
NameValueCollection myQueryStringCollection = new NameValueCollection(); var uri = uriBuilder.Uri;
myQueryStringCollection.Add(XenAdminConfigManager.Provider.GetInternalStageAuthTokenName(), _authToken); if (!uri.IsFile)
_client.QueryString = myQueryStringCollection; {
uriBuilder.Query = Helpers.AddAuthTokenToQueryString(_authToken, uriBuilder.Query);
}
} }
_client.DownloadFileAsync(_address, _outputPathAndFileName); _client.DownloadFileAsync(uriBuilder.Uri, _outputPathAndFileName);
bool updateDownloadCancelling = false; bool updateDownloadCancelling = false;