From 242982ff0beedba8d85486fc5ccd22699d30fb68 Mon Sep 17 00:00:00 2001 From: uwaa Date: Sun, 19 Jan 2025 01:27:00 +0000 Subject: [PATCH] pleroma: do not auth remote media --- Pleroma/Pleroma.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Pleroma/Pleroma.cs b/Pleroma/Pleroma.cs index 8b3fe89..6761f89 100644 --- a/Pleroma/Pleroma.cs +++ b/Pleroma/Pleroma.cs @@ -669,7 +669,11 @@ public class Pleroma /// public async Task DownloadStream(Attachment attachment) { - HttpResponseMessage res = await HttpClient.GetAsync(attachment.URL); + using HttpClient client = new HttpClient(); + if (HttpClient.BaseAddress != null && new Uri(attachment.URL).Host == HttpClient.BaseAddress.Host) + client.DefaultRequestHeaders.Authorization = HttpClient.DefaultRequestHeaders.Authorization; + + HttpResponseMessage res = await client.GetAsync(attachment.URL); res.EnsureSuccessStatusCode(); return await res.Content.ReadAsStreamAsync(); }