From bce305b216d8f5e162faccb4b3b402241f2623c2 Mon Sep 17 00:00:00 2001 From: JT Date: Thu, 29 Feb 2024 19:11:51 -0800 Subject: [PATCH] Fix civitai login dialog not showing when needed --- CHANGELOG.md | 1 + StabilityMatrix.Core/Services/DownloadService.cs | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 95f5de92..a12e0b83 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning 2.0](https://semver.org/spec/v2 - (Internal) Updated to Avalonia 11.0.9 ### Fixed - Fixed image viewer dialog arrow key navigation not working +- Fixed CivitAI login prompt not showing when downloading models that require CivitAI logins ## v2.9.0-pre.1 ### Added diff --git a/StabilityMatrix.Core/Services/DownloadService.cs b/StabilityMatrix.Core/Services/DownloadService.cs index 1aeeb9d7..ffc44ebf 100644 --- a/StabilityMatrix.Core/Services/DownloadService.cs +++ b/StabilityMatrix.Core/Services/DownloadService.cs @@ -1,4 +1,5 @@ -using System.Net.Http.Headers; +using System.Net; +using System.Net.Http.Headers; using Microsoft.Extensions.Logging; using Polly.Contrib.WaitAndRetry; using StabilityMatrix.Core.Attributes; @@ -184,6 +185,10 @@ public class DownloadService : IDownloadService throw new UnauthorizedAccessException(); } } + else if (noRedirectResponse.StatusCode == HttpStatusCode.Unauthorized) + { + throw new UnauthorizedAccessException(); + } using var redirectRequest = new HttpRequestMessage(); redirectRequest.Method = HttpMethod.Get;