[backend/federation] Fix media being incorrectly classified as sensitive

Some AP implementations send an empty string as content warning when they mean no content warning, this is handled correctly by CreateNoteAsync and UpdateNoteAsync but wasn't respected in the attachment processing code paths. This commit resolves that issue.
This commit is contained in:
Laura Hausmann 2024-05-06 16:44:56 +02:00
parent 039d46477a
commit b6304dc882
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -759,7 +759,7 @@ public class NoteService(
};
}
var sensitive = (note.Sensitive ?? false) || cw != null;
var sensitive = (note.Sensitive ?? false) || !string.IsNullOrWhiteSpace(cw);
var files = await ProcessAttachmentsAsync(note.Attachments, actor, sensitive);
var emoji = (await emojiSvc.ProcessEmojiAsync(note.Tags?.OfType<ASEmoji>().ToList(), actor.Host))
.Select(p => p.Id)
@ -820,7 +820,7 @@ public class NoteService(
};
}
var sensitive = (note.Sensitive ?? false) || dbNote.Cw != null;
var sensitive = (note.Sensitive ?? false) || !string.IsNullOrWhiteSpace(cw);
var files = await ProcessAttachmentsAsync(note.Attachments, actor, sensitive, false);
var emoji = (await emojiSvc.ProcessEmojiAsync(note.Tags?.OfType<ASEmoji>().ToList(), actor.Host))
.Select(p => p.Id)