fix: #13888, decode html entities for AP category name and description

This commit is contained in:
Julian Lam
2026-01-13 10:36:03 -05:00
parent d2f8af25f6
commit 6eea4df5ef
2 changed files with 23 additions and 3 deletions

View File

@@ -576,9 +576,9 @@ Mocks.actors.category = async (cid) => {
outbox: `${nconf.get('url')}/category/${cid}/outbox`,
type: 'Group',
name,
name: utils.decodeHTMLEntities(name),
preferredUsername,
summary,
summary: utils.decodeHTMLEntities(summary),
// image, // todo once categories have cover photos
icon,
postingRestrictedToMods: !canPost,

View File

@@ -16,7 +16,7 @@ const slugify = require('../../src/slugify');
const helpers = require('./helpers');
describe('Actor asserton', () => {
describe('as:Person (Actor asserton)', () => {
before(async () => {
meta.config.activitypubEnabled = 1;
await install.giveWorldPrivileges();
@@ -514,6 +514,26 @@ describe('Controllers', () => {
url: `${nconf.get('url')}/assets/uploads/files/test.png`,
});
});
it('should not contain html entities in name and summary', async () => {const payload = {};
payload[cid] = {
name: 'One & Two',
description: 'This is a category for one & two',
};
await categories.update(payload);
const { body } = await request.get(`${nconf.get('url')}/category/${cid}`, {
headers: {
Accept: 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"',
},
});
const { name, summary } = body;
assert.deepStrictEqual({ name, summary }, {
name: 'One & Two',
summary: 'This is a category for one & two',
});
});
});
describe('Instance Actor endpoint', () => {