Skip to content

A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.

TypeScript fluxerfluxerapp

fix(media-proxy): read content length from the response header (#2244)

Hampusb4a2af75d0a4
diff --git a/fluxer_media_proxy/src/server.rs b/fluxer_media_proxy/src/server.rs
index f7aa0bcbe..460cb1ec1 100644
--- a/fluxer_media_proxy/src/server.rs
+++ b/fluxer_media_proxy/src/server.rs
@@ -1610,7 +1610,12 @@ async fn fetch_external_inner(
.get(header::CONTENT_RANGE)
.and_then(|value| value.to_str().ok())
.map(ToOwned::to_owned);
- let content_length = response.content_length();
+ let content_length = response
+ .headers()
+ .get(header::CONTENT_LENGTH)
+ .and_then(|value| value.to_str().ok())
+ .and_then(|value| value.parse::<u64>().ok())
+ .or_else(|| response.content_length());
if let Some(len) = content_length
&& len > constants::MAX_MEDIA_PROXY_BYTES as u64
{