about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-07-31 13:26:33 +0200
committerRory& <root@rory.gay>2025-07-31 13:26:33 +0200
commit26ef7699cc9355b69868130cecdce6cf52bae71b (patch)
treebe49a33c9adf85bb1608a3392277721aa33e9906
parentFollow retry-after or fall back to 500ms on ratelimit exceeded errors (diff)
downloadLibMatrix-26ef7699cc9355b69868130cecdce6cf52bae71b.tar.xz
Try to detect authenticated media support by sending GET requests and discarding the response, since HEAD apparently isn't valid against all media repo implementations.
-rw-r--r--LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs6
1 files changed, 4 insertions, 2 deletions
diff --git a/LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs b/LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs

index e5095f1..e2f52cd 100644 --- a/LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs +++ b/LibMatrix/Homeservers/AuthenticatedHomeserverGeneric.cs
@@ -439,7 +439,8 @@ public class AuthenticatedHomeserverGeneric : RemoteHomeserver { try { // Console.WriteLine($"Trying authenticated media URL: {uri}"); var res = await ClientHttpClient.SendAsync(new() { - Method = HttpMethod.Head, + // Method = HttpMethod.Head, // This apparently doesn't work with Matrix-Media-Repo... + Method = HttpMethod.Get, RequestUri = (new Uri(mxcUri.ToDownloadUri(BaseUrl, filename, timeout), string.IsNullOrWhiteSpace(BaseUrl) ? UriKind.Relative : UriKind.Absolute)) }); if (res.IsSuccessStatusCode) { @@ -455,7 +456,8 @@ public class AuthenticatedHomeserverGeneric : RemoteHomeserver { try { // Console.WriteLine($"Trying legacy media URL: {uri}"); var res = await ClientHttpClient.SendAsync(new() { - Method = HttpMethod.Head, + // Method = HttpMethod.Head, + Method = HttpMethod.Get, RequestUri = new(mxcUri.ToLegacyDownloadUri(BaseUrl, filename, timeout), string.IsNullOrWhiteSpace(BaseUrl) ? UriKind.Relative : UriKind.Absolute) }); if (res.IsSuccessStatusCode) {