mirror of
https://github.com/fluxerapp/fluxer.git
synced 2026-09-03 05:10:25 +03:00
fix(media-proxy): read content length from the response header (#2244)
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user