1
0
Fork 0
mirror of https://gitlab.com/famedly/conduit.git synced 2025-04-22 14:10:16 +03:00

Rate limit => NotFound

This commit is contained in:
Steven Vergenz 2024-10-30 21:22:13 -07:00
parent c8d5b05855
commit 6a4cff1661

View file

@ -308,17 +308,18 @@ pub async fn get_media_preview_route(
));
}
if let Ok(preview) = get_url_preview(&url).await {
let res = serde_json::value::to_raw_value(&preview).expect("Converting to JSON failed");
return Ok(get_media_preview::v3::Response::from_raw_value(res));
}
Err(Error::BadRequest(
ErrorKind::LimitExceeded {
retry_after: Some(RetryAfter::Delay(Duration::from_secs(5))),
match get_url_preview(&url).await {
Ok(preview) => {
let res = serde_json::value::to_raw_value(&preview).expect("Converting to JSON failed");
Ok(get_media_preview::v3::Response::from_raw_value(res))
},
"Retry later",
))
Err(_) => {
Err(Error::BadRequest(
ErrorKind::NotFound,
"Failed to find preview data",
))
},
}
}
/// # `POST /_matrix/media/r0/upload`