Don't stop activity processing on invalid local mentions

This commit is contained in:
silverpill 2023-01-11 19:49:12 +00:00
parent 2385601e12
commit 7218864563
3 changed files with 11 additions and 3 deletions

View file

@ -17,6 +17,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Fixed
- 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

View file

@ -146,8 +146,10 @@ pub async fn get_or_import_profile_by_actor_address(
&acct,
).await {
Ok(profile) => profile,
Err(DatabaseError::NotFound(_)) => {
// TODO: don't fetch if address is local
Err(db_error @ DatabaseError::NotFound(_)) => {
if actor_address.hostname == instance.hostname() {
return Err(db_error.into());
};
import_profile_by_actor_address(
db_client,
instance,

View file

@ -20,6 +20,7 @@ use crate::activitypub::{
vocabulary::*,
};
use crate::config::{Config, Instance};
use crate::database::DatabaseError;
use crate::errors::{ConversionError, ValidationError};
use crate::models::attachments::queries::create_attachment;
use crate::models::posts::{
@ -275,8 +276,12 @@ pub async fn handle_note(
&actor_address,
).await {
Ok(profile) => profile,
Err(HandlerError::FetchError(error)) => {
Err(error @ (
HandlerError::FetchError(_) |
HandlerError::DatabaseError(DatabaseError::NotFound(_))
)) => {
// Ignore mention if fetcher fails
// Ignore mention if local address is not valid
log::warn!(
"failed to find mentioned profile {}: {}",
actor_address,