diff --git a/src/vpk/Velopack.Flow/Commands/ApiCommandRunner.cs b/src/vpk/Velopack.Flow/Commands/ApiCommandRunner.cs index 5fee89fa..a70aae6d 100644 --- a/src/vpk/Velopack.Flow/Commands/ApiCommandRunner.cs +++ b/src/vpk/Velopack.Flow/Commands/ApiCommandRunner.cs @@ -19,7 +19,7 @@ public class ApiCommandRunner(ILogger logger, IFancyConsole console) : ICommand< return; } - string response = await client.InvokeEndpointAsync(options, options.Endpoint, options.Method, options.Body, token); + string response = await client.InvokeEndpointAsync(options.Endpoint, options.Method, options.Body, token); Console.WriteLine(response); } } \ No newline at end of file diff --git a/src/vpk/Velopack.Flow/HmacAuthHttpClientHandler.cs b/src/vpk/Velopack.Flow/HmacAuthHttpClientHandler.cs index 3696ed8a..ebd906df 100644 --- a/src/vpk/Velopack.Flow/HmacAuthHttpClientHandler.cs +++ b/src/vpk/Velopack.Flow/HmacAuthHttpClientHandler.cs @@ -3,7 +3,7 @@ using System.Net.Http.Headers; namespace Velopack.Flow; -public class HmacAuthHttpClientHandler : DelegatingHandler +public class HmacAuthHttpClientHandler(HttpMessageHandler innerHandler) : DelegatingHandler(innerHandler) { protected override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { diff --git a/src/vpk/Velopack.Flow/VelopackFlowServiceClient.cs b/src/vpk/Velopack.Flow/VelopackFlowServiceClient.cs index 62064e0c..587b8fc3 100644 --- a/src/vpk/Velopack.Flow/VelopackFlowServiceClient.cs +++ b/src/vpk/Velopack.Flow/VelopackFlowServiceClient.cs @@ -33,10 +33,11 @@ public class VelopackFlowServiceClient( private HttpClient GetHttpClient(Action? progress = null) { - HttpMessageHandler primaryHandler = new HmacAuthHttpClientHandler(); + HttpMessageHandler handler; if (progress != null) { - var ph = new HttpFormatting::System.Net.Http.Handlers.ProgressMessageHandler(primaryHandler); + var ph = new HttpFormatting::System.Net.Http.Handlers.ProgressMessageHandler( + new HmacAuthHttpClientHandler(new HttpClientHandler() { AllowAutoRedirect = true })); ph.HttpSendProgress += (_, args) => { progress(args.ProgressPercentage); // Console.WriteLine($"upload progress: {((double)args.BytesTransferred / args.TotalBytes) * 100.0}"); @@ -44,11 +45,12 @@ public class VelopackFlowServiceClient( ph.HttpReceiveProgress += (_, args) => { progress(args.ProgressPercentage); }; - - primaryHandler = ph; + handler = ph; + } else { + handler = new HmacAuthHttpClientHandler(new HttpClientHandler() { AllowAutoRedirect = true }); } - var client = new HttpClient(primaryHandler); + var client = new HttpClient(handler); client.DefaultRequestHeaders.Authorization = Authorization; client.Timeout = TimeSpan.FromMinutes(Options.Timeout); return client; @@ -132,7 +134,6 @@ public class VelopackFlowServiceClient( } public async Task InvokeEndpointAsync( - VelopackFlowServiceOptions? options, string endpointUri, string method, string? body, @@ -184,6 +185,7 @@ public class VelopackFlowServiceClient( var filesToUpload = assets.GetNonReleaseAssetPaths().Select(p => (p, FileType.Installer)) .Concat([(fullAssetPath, FileType.Release)]) + .Where(kvp => !kvp.Item1.Contains("-Portable.zip")) .ToArray(); Logger.LogInformation("Beginning upload to Velopack Flow");