mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-12-22 19:01:32 +00:00
Increase metadata fetch limit to 1 MB (fixes #5208)
This commit is contained in:
parent
8d91543a13
commit
1e554c98c3
1 changed files with 5 additions and 3 deletions
|
@ -51,9 +51,11 @@ pub fn client_builder(settings: &Settings) -> ClientBuilder {
|
||||||
#[tracing::instrument(skip_all)]
|
#[tracing::instrument(skip_all)]
|
||||||
pub async fn fetch_link_metadata(url: &Url, context: &LemmyContext) -> LemmyResult<LinkMetadata> {
|
pub async fn fetch_link_metadata(url: &Url, context: &LemmyContext) -> LemmyResult<LinkMetadata> {
|
||||||
info!("Fetching site metadata for url: {}", url);
|
info!("Fetching site metadata for url: {}", url);
|
||||||
// We only fetch the first 64kB of data in order to not waste bandwidth especially for large
|
// We only fetch the first MB of data in order to not waste bandwidth especially for large
|
||||||
// binary files
|
// binary files. This high limit is particularly needed for youtube, which includes a lot of
|
||||||
let bytes_to_fetch = 64 * 1024;
|
// javascript code before the opengraph tags. Mastodon also uses a 1 MB limit:
|
||||||
|
// https://github.com/mastodon/mastodon/blob/295ad6f19a016b3f16e1201ffcbb1b3ad6b455a2/app/lib/request.rb#L213
|
||||||
|
let bytes_to_fetch = 1024 * 1024;
|
||||||
let response = context
|
let response = context
|
||||||
.client()
|
.client()
|
||||||
.get(url.as_str())
|
.get(url.as_str())
|
||||||
|
|
Loading…
Reference in a new issue