Skip to content

Node.js based forum software built for the modern web

fix: #13419, handle remote content with mediaType text/markdown

Julian Lam45a11d45fc2c
diff --git a/src/activitypub/mocks.js b/src/activitypub/mocks.js
index f2a8446d4a..fee85cd6bd 100644
--- a/src/activitypub/mocks.js
+++ b/src/activitypub/mocks.js
@@ -42,7 +42,7 @@ const sanitizeConfig = {
Mocks._normalize = async (object) => {
// Normalized incoming AP objects into expected types for easier mocking
- let { type, attributedTo, url, image, content, source, attachment } = object;
+ let { type, attributedTo, url, image, mediaType, content, source, attachment } = object;
switch (true) { // non-string attributedTo handling
case Array.isArray(attributedTo): {
@@ -70,6 +70,9 @@ Mocks._normalize = async (object) => {
if (sourceContent) {
content = null;
sourceContent = await activitypub.helpers.remoteAnchorToLocalProfile(sourceContent, true);
+ } else if (mediaType === 'text/markdown') {
+ sourceContent = await activitypub.helpers.remoteAnchorToLocalProfile(content, true);
+ content = null;
} else if (content && content.length) {
content = sanitize(content, sanitizeConfig);
content = await activitypub.helpers.remoteAnchorToLocalProfile(content);