Don't stop activity processing on invalid local mentions
This commit is contained in:
parent
2385601e12
commit
7218864563
3 changed files with 11 additions and 3 deletions
|
@ -17,6 +17,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Don't ignore `Delete(Person)` verification errors if database error subtype is not `NotFound`.
|
- Don't ignore `Delete(Person)` verification errors if database error subtype is not `NotFound`.
|
||||||
|
- Don't stop activity processing on invalid local mentions.
|
||||||
|
|
||||||
## [1.9.0] - 2023-01-08
|
## [1.9.0] - 2023-01-08
|
||||||
|
|
||||||
|
|
|
@ -146,8 +146,10 @@ pub async fn get_or_import_profile_by_actor_address(
|
||||||
&acct,
|
&acct,
|
||||||
).await {
|
).await {
|
||||||
Ok(profile) => profile,
|
Ok(profile) => profile,
|
||||||
Err(DatabaseError::NotFound(_)) => {
|
Err(db_error @ DatabaseError::NotFound(_)) => {
|
||||||
// TODO: don't fetch if address is local
|
if actor_address.hostname == instance.hostname() {
|
||||||
|
return Err(db_error.into());
|
||||||
|
};
|
||||||
import_profile_by_actor_address(
|
import_profile_by_actor_address(
|
||||||
db_client,
|
db_client,
|
||||||
instance,
|
instance,
|
||||||
|
|
|
@ -20,6 +20,7 @@ use crate::activitypub::{
|
||||||
vocabulary::*,
|
vocabulary::*,
|
||||||
};
|
};
|
||||||
use crate::config::{Config, Instance};
|
use crate::config::{Config, Instance};
|
||||||
|
use crate::database::DatabaseError;
|
||||||
use crate::errors::{ConversionError, ValidationError};
|
use crate::errors::{ConversionError, ValidationError};
|
||||||
use crate::models::attachments::queries::create_attachment;
|
use crate::models::attachments::queries::create_attachment;
|
||||||
use crate::models::posts::{
|
use crate::models::posts::{
|
||||||
|
@ -275,8 +276,12 @@ pub async fn handle_note(
|
||||||
&actor_address,
|
&actor_address,
|
||||||
).await {
|
).await {
|
||||||
Ok(profile) => profile,
|
Ok(profile) => profile,
|
||||||
Err(HandlerError::FetchError(error)) => {
|
Err(error @ (
|
||||||
|
HandlerError::FetchError(_) |
|
||||||
|
HandlerError::DatabaseError(DatabaseError::NotFound(_))
|
||||||
|
)) => {
|
||||||
// Ignore mention if fetcher fails
|
// Ignore mention if fetcher fails
|
||||||
|
// Ignore mention if local address is not valid
|
||||||
log::warn!(
|
log::warn!(
|
||||||
"failed to find mentioned profile {}: {}",
|
"failed to find mentioned profile {}: {}",
|
||||||
actor_address,
|
actor_address,
|
||||||
|
|
Loading…
Reference in a new issue