summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorTamme Schichler <tamme@schichler.dev>2024-10-28 13:06:16 +0100
committerGitHub <noreply@github.com>2024-10-28 21:06:16 +0900
commit8eb7749e448d912bdbe2c4eadc35f5d5f1becf61 (patch)
treeb89b5fe613cdbc29514642d173db4283ad2ea3a2 /packages
parentfix: encode RSS uris with escape sequences before fetching (#14826) (diff)
downloadmisskey-8eb7749e448d912bdbe2c4eadc35f5d5f1becf61.tar.gz
misskey-8eb7749e448d912bdbe2c4eadc35f5d5f1becf61.tar.bz2
misskey-8eb7749e448d912bdbe2c4eadc35f5d5f1becf61.zip
fix(backend): Accept arrays in ActivityPub `icon` and `image` properties (#14825)
This is allowed according to the Activity vocabulary: https://www.w3.org/TR/activitystreams-vocabulary/#dfn-icon The issue is noticeable in combination with Bridgy Fed: https://github.com/snarfed/bridgy-fed/issues/1408
Diffstat (limited to 'packages')
-rw-r--r--packages/backend/src/core/activitypub/models/ApPersonService.ts6
1 files changed, 6 insertions, 0 deletions
diff --git a/packages/backend/src/core/activitypub/models/ApPersonService.ts b/packages/backend/src/core/activitypub/models/ApPersonService.ts
index 0e2934301b..c9de67b3a0 100644
--- a/packages/backend/src/core/activitypub/models/ApPersonService.ts
+++ b/packages/backend/src/core/activitypub/models/ApPersonService.ts
@@ -232,6 +232,12 @@ export class ApPersonService implements OnModuleInit {
if (user == null) throw new Error('failed to create user: user is null');
const [avatar, banner] = await Promise.all([icon, image].map(img => {
+ // icon and image may be arrays
+ // see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-icon
+ if (Array.isArray(img)) {
+ img = img.find(item => item && item.url) ?? null;
+ }
+
// if we have an explicitly missing image, return an
// explicitly-null set of values
if ((img == null) || (typeof img === 'object' && img.url == null)) {