clippy
This commit is contained in:
parent
3a5c621e17
commit
6a42c7dee7
2 changed files with 6 additions and 9 deletions
|
|
@ -78,9 +78,6 @@ pub enum Error {
|
||||||
/// Attempted to fetch object but the response's id field doesn't match
|
/// Attempted to fetch object but the response's id field doesn't match
|
||||||
#[error("Attempted to fetch object from {0} but the response's id field doesn't match")]
|
#[error("Attempted to fetch object from {0} but the response's id field doesn't match")]
|
||||||
FetchWrongId(Url),
|
FetchWrongId(Url),
|
||||||
/// Object which has local domain cannot be fetched over HTTP
|
|
||||||
#[error("Object which has local domain cannot be fetched over HTTP")]
|
|
||||||
CannotDereferenceLocalObject,
|
|
||||||
/// Other generic errors
|
/// Other generic errors
|
||||||
#[error("{0}")]
|
#[error("{0}")]
|
||||||
Other(String),
|
Other(String),
|
||||||
|
|
|
||||||
|
|
@ -158,10 +158,6 @@ where
|
||||||
where
|
where
|
||||||
<Kind as Object>::Error: From<Error>,
|
<Kind as Object>::Error: From<Error>,
|
||||||
{
|
{
|
||||||
if self.is_local(data) {
|
|
||||||
return Err(Error::CannotDereferenceLocalObject.into());
|
|
||||||
}
|
|
||||||
|
|
||||||
let res = Box::pin(fetch_object_http(&self.0, data)).await;
|
let res = Box::pin(fetch_object_http(&self.0, data)).await;
|
||||||
|
|
||||||
if let Err(Error::ObjectDeleted(url)) = res {
|
if let Err(Error::ObjectDeleted(url)) = res {
|
||||||
|
|
@ -174,8 +170,12 @@ where
|
||||||
let res = res?;
|
let res = res?;
|
||||||
let redirect_url = &res.url;
|
let redirect_url = &res.url;
|
||||||
|
|
||||||
if data.config.is_local_url(&redirect_url) {
|
// Prevent overwriting local object
|
||||||
return Err(Error::CannotDereferenceLocalObject.into());
|
if data.config.is_local_url(redirect_url) {
|
||||||
|
return self
|
||||||
|
.dereference_from_db(data)
|
||||||
|
.await?
|
||||||
|
.ok_or(Error::NotFound.into());
|
||||||
}
|
}
|
||||||
|
|
||||||
Box::pin(Kind::verify(&res.object, redirect_url, data)).await?;
|
Box::pin(Kind::verify(&res.object, redirect_url, data)).await?;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue