From 57e17e7607c5d98de8ded6cfe12e19f1b70bac4b Mon Sep 17 00:00:00 2001 From: Jesse Wierzbinski Date: Mon, 2 Dec 2024 15:43:56 +0100 Subject: [PATCH] fix(cli): :label: Handle possible undefined values on some variables --- cli/commands/federation/user/fetch.ts | 5 +++++ cli/commands/federation/user/finger.ts | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/cli/commands/federation/user/fetch.ts b/cli/commands/federation/user/fetch.ts index 33271d0b..5addeed6 100644 --- a/cli/commands/federation/user/fetch.ts +++ b/cli/commands/federation/user/fetch.ts @@ -37,6 +37,11 @@ export default class FederationUserFetch extends BaseCommand< const { username, domain: host } = parseUserAddress(args.address); + if (!host) { + this.log("Address must contain a domain."); + this.exit(1); + } + // Check instance exists, if not, create it await Instance.resolve(`https://${host}`); diff --git a/cli/commands/federation/user/finger.ts b/cli/commands/federation/user/finger.ts index 78f7aac1..1f969aba 100644 --- a/cli/commands/federation/user/finger.ts +++ b/cli/commands/federation/user/finger.ts @@ -38,6 +38,11 @@ export default class FederationUserFinger extends BaseCommand< const { username, domain: host } = parseUserAddress(args.address); + if (!host) { + this.log("Address must contain a domain."); + this.exit(1); + } + // Check instance exists, if not, create it await Instance.resolve(`https://${host}`);