From 194d656bb47bb2fd5c213ea0d8b731b26cad726c Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Fri, 17 Feb 2023 09:06:31 +0100 Subject: [PATCH] fix: normalize empty value of `name` into an absent value --- .../backend/src/core/activitypub/models/ApPersonService.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/backend/src/core/activitypub/models/ApPersonService.ts b/packages/backend/src/core/activitypub/models/ApPersonService.ts index a1fdd7a198..d06958da0c 100644 --- a/packages/backend/src/core/activitypub/models/ApPersonService.ts +++ b/packages/backend/src/core/activitypub/models/ApPersonService.ts @@ -164,6 +164,9 @@ export class ApPersonService implements OnModuleInit { throw new Error('invalid Actor: wrong name'); } x.name = truncate(x.name, nameLength); + } else if (x.name === '') { + // Mastodon emits empty string when the name is not set. + x.name = undefined; } if (x.summary) { if (!(typeof x.summary === 'string' && x.summary.length > 0)) {