Skip to content

Commit

Permalink
[PM-4077] safeincloud multiple url fix (#6394)
Browse files Browse the repository at this point in the history
* safeincloud multiple url fix
* Ensure LoginView.uris is consistently populated
  • Loading branch information
sonigeez authored Dec 14, 2023
1 parent 00fd45a commit 96d1c83
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions libs/common/src/vault/models/view/login.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class LoginView extends ItemView {

passwordRevisionDate?: Date = null;
totp: string = null;
uris: LoginUriView[] = null;
uris: LoginUriView[] = [];
autofillOnPageLoad: boolean = null;
fido2Credentials: Fido2CredentialView[] = null;

Expand Down Expand Up @@ -62,7 +62,7 @@ export class LoginView extends ItemView {
}

get hasUris(): boolean {
return this.uris != null && this.uris.length > 0;
return this.uris.length > 0;
}

get hasFido2Credentials(): boolean {
Expand All @@ -84,7 +84,7 @@ export class LoginView extends ItemView {
static fromJSON(obj: Partial<Jsonify<LoginView>>): LoginView {
const passwordRevisionDate =
obj.passwordRevisionDate == null ? null : new Date(obj.passwordRevisionDate);
const uris = obj.uris?.map((uri: any) => LoginUriView.fromJSON(uri));
const uris = obj.uris.map((uri: any) => LoginUriView.fromJSON(uri));
const fido2Credentials = obj.fido2Credentials?.map((key) => Fido2CredentialView.fromJSON(key));

return Object.assign(new LoginView(), obj, {
Expand Down
2 changes: 1 addition & 1 deletion libs/importer/src/importers/safeincloud-xml-importer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export class SafeInCloudXmlImporter extends BaseImporter implements Importer {
} else if (fieldType === "notes") {
cipher.notes += text + "\n";
} else if (fieldType === "weblogin" || fieldType === "website") {
cipher.login.uris = this.makeUriArray(text);
cipher.login.uris.push(...this.makeUriArray(text));
} else {
this.processKvp(cipher, name, text);
}
Expand Down

0 comments on commit 96d1c83

Please sign in to comment.