Skip to content

Commit

Permalink
Correct bug when title parameter is missing from credentials (#51)
Browse files Browse the repository at this point in the history
Correct bug #42 that happens when the title parameter is missing from
the credentials.
The fix is to use the url instead of the title parameter when the latest
is missing.
  • Loading branch information
Mikescops authored Feb 28, 2023
2 parents ed5bfbf + 24c0258 commit ffa356e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/middleware/getPasswords.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ export const getPassword = async (params: GetCredential): Promise<void> => {
switch (params.output || 'clipboard') {
case 'clipboard':
clipboard.writeSync(selectedCredential.password);
console.log(`🔓 Password for "${selectedCredential.title}" copied to clipboard!`);
console.log(
`🔓 Password for "${selectedCredential.title || selectedCredential.url || 'N\\C'}" copied to clipboard!`
);

if (selectedCredential.otpSecret) {
const token = authenticator.generate(selectedCredential.otpSecret);
Expand Down
4 changes: 2 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export interface SecureNoteTransactionContent {
}

export interface VaultCredential {
title: string;
title?: string;
email?: string;
login?: string;
password: string;
Expand Down Expand Up @@ -152,7 +152,7 @@ export class PrintableVaultCredential {

toString(): string {
return (
this.vaultCredential.title.trim() +
(this.vaultCredential.title?.trim() || this.vaultCredential.url || 'N\\C') +
' - ' +
(this.vaultCredential.email?.trim() ||
this.vaultCredential.login?.trim() ||
Expand Down

0 comments on commit ffa356e

Please sign in to comment.