mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-24 08:19:48 +01:00
fix: #13888, decode html entities for AP category name and description
This commit is contained in:
@@ -576,9 +576,9 @@ Mocks.actors.category = async (cid) => {
|
|||||||
outbox: `${nconf.get('url')}/category/${cid}/outbox`,
|
outbox: `${nconf.get('url')}/category/${cid}/outbox`,
|
||||||
|
|
||||||
type: 'Group',
|
type: 'Group',
|
||||||
name,
|
name: utils.decodeHTMLEntities(name),
|
||||||
preferredUsername,
|
preferredUsername,
|
||||||
summary,
|
summary: utils.decodeHTMLEntities(summary),
|
||||||
// image, // todo once categories have cover photos
|
// image, // todo once categories have cover photos
|
||||||
icon,
|
icon,
|
||||||
postingRestrictedToMods: !canPost,
|
postingRestrictedToMods: !canPost,
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ const slugify = require('../../src/slugify');
|
|||||||
|
|
||||||
const helpers = require('./helpers');
|
const helpers = require('./helpers');
|
||||||
|
|
||||||
describe('Actor asserton', () => {
|
describe('as:Person (Actor asserton)', () => {
|
||||||
before(async () => {
|
before(async () => {
|
||||||
meta.config.activitypubEnabled = 1;
|
meta.config.activitypubEnabled = 1;
|
||||||
await install.giveWorldPrivileges();
|
await install.giveWorldPrivileges();
|
||||||
@@ -514,6 +514,26 @@ describe('Controllers', () => {
|
|||||||
url: `${nconf.get('url')}/assets/uploads/files/test.png`,
|
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', () => {
|
describe('Instance Actor endpoint', () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user