From c59c7c7387f159537b9d352057299842f864b864 Mon Sep 17 00:00:00 2001 From: Cristian Dominguez Date: Wed, 25 Oct 2023 13:42:49 -0300 Subject: [PATCH 1/2] fix: handle alias file with no `orgs` prop --- src/stateAggregator/accessors/aliasAccessor.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/stateAggregator/accessors/aliasAccessor.ts b/src/stateAggregator/accessors/aliasAccessor.ts index b5701f53f9..112b5fe6a3 100644 --- a/src/stateAggregator/accessors/aliasAccessor.ts +++ b/src/stateAggregator/accessors/aliasAccessor.ts @@ -281,6 +281,10 @@ const fileContentsRawToAliasStore = (contents: string): Map => { [DEFAULT_GROUP]: { [alias: string]: string }; }; + // old alias file may not have `orgs` prop + if (!fileContents[DEFAULT_GROUP]) { + fileContents[DEFAULT_GROUP] = {}; + } return new Map(Object.entries(fileContents[DEFAULT_GROUP])); }; From ce1ebcb5396e5ee8d302fdcd639f7716d84e1a04 Mon Sep 17 00:00:00 2001 From: Cristian Dominguez <6853656+cristiand391@users.noreply.github.com> Date: Wed, 25 Oct 2023 14:51:30 -0300 Subject: [PATCH 2/2] Update src/stateAggregator/accessors/aliasAccessor.ts Co-authored-by: Shane McLaughlin --- src/stateAggregator/accessors/aliasAccessor.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/stateAggregator/accessors/aliasAccessor.ts b/src/stateAggregator/accessors/aliasAccessor.ts index 112b5fe6a3..0a6653624b 100644 --- a/src/stateAggregator/accessors/aliasAccessor.ts +++ b/src/stateAggregator/accessors/aliasAccessor.ts @@ -281,11 +281,8 @@ const fileContentsRawToAliasStore = (contents: string): Map => { [DEFAULT_GROUP]: { [alias: string]: string }; }; - // old alias file may not have `orgs` prop - if (!fileContents[DEFAULT_GROUP]) { - fileContents[DEFAULT_GROUP] = {}; - } - return new Map(Object.entries(fileContents[DEFAULT_GROUP])); + // handle when alias file exists but is missing the org property + return new Map(Object.entries(fileContents[DEFAULT_GROUP] ?? {})); }; const aliasStoreToRawFileContents = (aliasStore: Map): string =>