Fix type error in security fixes

This commit is contained in:
Julia Johannesen 2024-11-20 20:06:46 -05:00
parent 4b556efdaa
commit fa3cf6c299
No known key found for this signature in database
GPG Key ID: 4A1377AF3E7FBC46
1 changed files with 9 additions and 6 deletions

View File

@ -163,13 +163,16 @@ export class ApPersonService implements OnModuleInit {
}
for (const collection of ['outbox', 'followers', 'following'] as (keyof IActor)[]) {
const collectionUri = getApId((x as IActor)[collection]);
if (typeof collectionUri === 'string' && collectionUri.length > 0) {
if (this.utilityService.punyHost(collectionUri) !== expectHost) {
throw new Error(`invalid Actor: ${collection} has different host`);
const xCollection = (x as IActor)[collection];
if (xCollection != null) {
const collectionUri = getApId(xCollection);
if (typeof collectionUri === 'string' && collectionUri.length > 0) {
if (this.utilityService.punyHost(collectionUri) !== expectHost) {
throw new Error(`invalid Actor: ${collection} has different host`);
}
} else if (collectionUri != null) {
throw new Error(`invalid Actor: wrong ${collection}`);
}
} else if (collectionUri != null) {
throw new Error(`invalid Actor: wrong ${collection}`);
}
}