Skip to content

Node.js based forum software built for the modern web

fix: better handling for remote posts that do not contain content

Julian Lam3c55d1024d8c
diff --git a/src/activitypub/mocks.js b/src/activitypub/mocks.js
index 3e8d6424c4..6304c26daa 100644
--- a/src/activitypub/mocks.js
+++ b/src/activitypub/mocks.js
@@ -123,8 +123,12 @@ Mocks.post = async (objects) => {
let edited = new Date(updated);
edited = Number.isNaN(edited.valueOf()) ? undefined : edited;
- content = sanitize(content, sanitizeConfig);
- content = await activitypub.helpers.remoteAnchorToLocalProfile(content);
+ if (content && content.length) {
+ content = sanitize(content, sanitizeConfig);
+ content = await activitypub.helpers.remoteAnchorToLocalProfile(content);
+ } else {
+ content = '<em>This post did not contain any content.</em>';
+ }
const payload = {
uid,