Merge pull request #9970 from saschanaz/mkusername-empty

fix(backend/ApPersonService): normalize empty value of `name` into an absent value
This commit is contained in:
tamaina 2023-03-09 22:36:26 +09:00 committed by GitHub
commit dc49a24f07
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 41 additions and 30 deletions

View file

@ -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)) {