mirror of
https://codeberg.org/yeentown/barkey
synced 2024-11-27 08:03:01 +00:00
Fix type error in security fixes
This commit is contained in:
parent
4b556efdaa
commit
fa3cf6c299
1 changed files with 9 additions and 6 deletions
|
@ -163,7 +163,9 @@ export class ApPersonService implements OnModuleInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const collection of ['outbox', 'followers', 'following'] as (keyof IActor)[]) {
|
for (const collection of ['outbox', 'followers', 'following'] as (keyof IActor)[]) {
|
||||||
const collectionUri = getApId((x as IActor)[collection]);
|
const xCollection = (x as IActor)[collection];
|
||||||
|
if (xCollection != null) {
|
||||||
|
const collectionUri = getApId(xCollection);
|
||||||
if (typeof collectionUri === 'string' && collectionUri.length > 0) {
|
if (typeof collectionUri === 'string' && collectionUri.length > 0) {
|
||||||
if (this.utilityService.punyHost(collectionUri) !== expectHost) {
|
if (this.utilityService.punyHost(collectionUri) !== expectHost) {
|
||||||
throw new Error(`invalid Actor: ${collection} has different host`);
|
throw new Error(`invalid Actor: ${collection} has different host`);
|
||||||
|
@ -172,6 +174,7 @@ export class ApPersonService implements OnModuleInit {
|
||||||
throw new Error(`invalid Actor: wrong ${collection}`);
|
throw new Error(`invalid Actor: wrong ${collection}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!(typeof x.preferredUsername === 'string' && x.preferredUsername.length > 0 && x.preferredUsername.length <= 128 && /^\w([\w-.]*\w)?$/.test(x.preferredUsername))) {
|
if (!(typeof x.preferredUsername === 'string' && x.preferredUsername.length > 0 && x.preferredUsername.length <= 128 && /^\w([\w-.]*\w)?$/.test(x.preferredUsername))) {
|
||||||
throw new Error('invalid Actor: wrong username');
|
throw new Error('invalid Actor: wrong username');
|
||||||
|
|
Loading…
Reference in a new issue