pleroma: do not auth remote media
This commit is contained in:
parent
9d99c2a9c8
commit
242982ff0b
1 changed files with 5 additions and 1 deletions
|
@ -669,7 +669,11 @@ public class Pleroma
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public async Task<Stream> DownloadStream(Attachment attachment)
|
public async Task<Stream> 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();
|
res.EnsureSuccessStatusCode();
|
||||||
return await res.Content.ReadAsStreamAsync();
|
return await res.Content.ReadAsStreamAsync();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue