mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-16 21:40:23 +01:00
fix: null check on attachments property in assertPrivate
This commit is contained in:
@@ -340,8 +340,9 @@ Notes.assertPrivate = async (object) => {
|
|||||||
const payload = await activitypub.mocks.message(object);
|
const payload = await activitypub.mocks.message(object);
|
||||||
|
|
||||||
// Naive image appending (using src/posts/attachments.js is likely better, but not worth the effort)
|
// Naive image appending (using src/posts/attachments.js is likely better, but not worth the effort)
|
||||||
if (payload._activitypub.hasOwnProperty('attachment')) {
|
const attachments = payload._activitypub.attachment;
|
||||||
const images = payload._activitypub.attachment.filter((attachment) => {
|
if (attachments && Array.isArray(attachments)) {
|
||||||
|
const images = attachments.filter((attachment) => {
|
||||||
return attachment.mediaType.startsWith('image/');
|
return attachment.mediaType.startsWith('image/');
|
||||||
}).map(({ url, href }) => url || href);
|
}).map(({ url, href }) => url || href);
|
||||||
images.forEach((url) => {
|
images.forEach((url) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user