mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 14:23:32 +00:00
handle empty strings in identity view for sdk cipher encryption (#17423)
This commit is contained in:
@@ -94,16 +94,16 @@ export class IdentityView extends ItemView implements SdkIdentityView {
|
|||||||
this.lastName != null
|
this.lastName != null
|
||||||
) {
|
) {
|
||||||
let name = "";
|
let name = "";
|
||||||
if (this.title != null) {
|
if (!Utils.isNullOrWhitespace(this.title)) {
|
||||||
name += this.title + " ";
|
name += this.title + " ";
|
||||||
}
|
}
|
||||||
if (this.firstName != null) {
|
if (!Utils.isNullOrWhitespace(this.firstName)) {
|
||||||
name += this.firstName + " ";
|
name += this.firstName + " ";
|
||||||
}
|
}
|
||||||
if (this.middleName != null) {
|
if (!Utils.isNullOrWhitespace(this.middleName)) {
|
||||||
name += this.middleName + " ";
|
name += this.middleName + " ";
|
||||||
}
|
}
|
||||||
if (this.lastName != null) {
|
if (!Utils.isNullOrWhitespace(this.lastName)) {
|
||||||
name += this.lastName;
|
name += this.lastName;
|
||||||
}
|
}
|
||||||
return name.trim();
|
return name.trim();
|
||||||
@@ -130,14 +130,20 @@ export class IdentityView extends ItemView implements SdkIdentityView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get fullAddressPart2(): string | undefined {
|
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;
|
return undefined;
|
||||||
}
|
}
|
||||||
const city = this.city || "-";
|
|
||||||
|
const city = hasCity ? this.city : "-";
|
||||||
const state = this.state;
|
const state = this.state;
|
||||||
const postalCode = this.postalCode || "-";
|
const postalCode = hasPostalCode ? this.postalCode : "-";
|
||||||
|
|
||||||
let addressPart2 = city;
|
let addressPart2 = city;
|
||||||
if (!Utils.isNullOrWhitespace(state)) {
|
if (hasState) {
|
||||||
addressPart2 += ", " + state;
|
addressPart2 += ", " + state;
|
||||||
}
|
}
|
||||||
addressPart2 += ", " + postalCode;
|
addressPart2 += ", " + postalCode;
|
||||||
|
|||||||
Reference in New Issue
Block a user