diff --git a/src/models/user.ts b/src/models/user.ts index f817c33aa2..7c1ee498d6 100644 --- a/src/models/user.ts +++ b/src/models/user.ts @@ -100,7 +100,7 @@ export function validatePassword(password: string): boolean { } export function isValidName(name: string): boolean { - return typeof name == 'string' && name.length < 30 && name.trim() != ''; + return name === null || (typeof name == 'string' && name.length < 30 && name.trim() != ''); } export function isValidDescription(description: string): boolean { diff --git a/src/remote/activitypub/resolve-person.ts b/src/remote/activitypub/resolve-person.ts index 9cca50e416..39887ef776 100644 --- a/src/remote/activitypub/resolve-person.ts +++ b/src/remote/activitypub/resolve-person.ts @@ -24,7 +24,7 @@ export default async (value, verifier?: string) => { object.type !== 'Person' || typeof object.preferredUsername !== 'string' || !validateUsername(object.preferredUsername) || - (object.name != '' && !isValidName(object.name)) || + !isValidName(object.name == '' ? null : object.name) || !isValidDescription(object.summary) ) { throw new Error('invalid person');