diff --git a/src/Snap.Hutao/Snap.Hutao/Core/DependencyInjection/IocHttpClientConfiguration.cs b/src/Snap.Hutao/Snap.Hutao/Core/DependencyInjection/IocHttpClientConfiguration.cs index feff54e6..de8ef22b 100644 --- a/src/Snap.Hutao/Snap.Hutao/Core/DependencyInjection/IocHttpClientConfiguration.cs +++ b/src/Snap.Hutao/Snap.Hutao/Core/DependencyInjection/IocHttpClientConfiguration.cs @@ -25,6 +25,7 @@ internal static partial class IocHttpClientConfiguration .ConfigurePrimaryHttpMessageHandler((handler, provider) => { HttpClientHandler clientHandler = (HttpClientHandler)handler; + clientHandler.AllowAutoRedirect = true; clientHandler.UseProxy = true; clientHandler.Proxy = provider.GetRequiredService(); }); diff --git a/src/Snap.Hutao/Snap.Hutao/ViewModel/Guide/DownloadSummary.cs b/src/Snap.Hutao/Snap.Hutao/ViewModel/Guide/DownloadSummary.cs index 9942256e..bd98fd8c 100644 --- a/src/Snap.Hutao/Snap.Hutao/ViewModel/Guide/DownloadSummary.cs +++ b/src/Snap.Hutao/Snap.Hutao/ViewModel/Guide/DownloadSummary.cs @@ -76,9 +76,10 @@ internal sealed class DownloadSummary : ObservableObject { HttpResponseMessage response = await httpClient.GetAsync(fileUrl, HttpCompletionOption.ResponseHeadersRead).ConfigureAwait(false); - if (response.Content.Headers.ContentType?.MediaType is not "application/octet-stream") + if (response.Content.Headers.ContentType?.MediaType is not ("application/octet-stream" or "application/zip")) { logger.LogWarning("Download Static Zip failed, Content-Type is {Type}", response.Content.Headers.ContentType); + await taskContext.SwitchToMainThreadAsync(); Description = SH.ViewModelWelcomeDownloadSummaryContentTypeNotMatch; return false; }