From 5b1ff21e246269d4f2a5ac3dcfb23fca98219eaf Mon Sep 17 00:00:00 2001 From: SmithThe4th Date: Mon, 17 Nov 2025 15:10:50 -0500 Subject: [PATCH] handle empty strings in identity view for sdk cipher encryption (#17423) --- .../src/vault/models/view/identity.view.ts | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/libs/common/src/vault/models/view/identity.view.ts b/libs/common/src/vault/models/view/identity.view.ts index dca54fa04e8..fadfafb8777 100644 --- a/libs/common/src/vault/models/view/identity.view.ts +++ b/libs/common/src/vault/models/view/identity.view.ts @@ -94,16 +94,16 @@ export class IdentityView extends ItemView implements SdkIdentityView { this.lastName != null ) { let name = ""; - if (this.title != null) { + if (!Utils.isNullOrWhitespace(this.title)) { name += this.title + " "; } - if (this.firstName != null) { + if (!Utils.isNullOrWhitespace(this.firstName)) { name += this.firstName + " "; } - if (this.middleName != null) { + if (!Utils.isNullOrWhitespace(this.middleName)) { name += this.middleName + " "; } - if (this.lastName != null) { + if (!Utils.isNullOrWhitespace(this.lastName)) { name += this.lastName; } return name.trim(); @@ -130,14 +130,20 @@ export class IdentityView extends ItemView implements SdkIdentityView { } get fullAddressPart2(): string | undefined { - if (this.city == null && this.state == null && this.postalCode == null) { + const hasCity = !Utils.isNullOrWhitespace(this.city); + const hasState = !Utils.isNullOrWhitespace(this.state); + const hasPostalCode = !Utils.isNullOrWhitespace(this.postalCode); + + if (!hasCity && !hasState && !hasPostalCode) { return undefined; } - const city = this.city || "-"; + + const city = hasCity ? this.city : "-"; const state = this.state; - const postalCode = this.postalCode || "-"; + const postalCode = hasPostalCode ? this.postalCode : "-"; + let addressPart2 = city; - if (!Utils.isNullOrWhitespace(state)) { + if (hasState) { addressPart2 += ", " + state; } addressPart2 += ", " + postalCode;