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:
parent
c8d5b05855
commit
6a4cff1661
1 changed files with 11 additions and 10 deletions
|
@ -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`
|
||||
|
|
Loading…
Reference in a new issue