mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 08:13:42 +00:00
Add context menu entry sanitation (#1198)
Fixes a bug where a context menu entry (auto-fill, copy password, etc.) would display incorrectly when it included an ampersand.
This commit is contained in:
@@ -560,7 +560,7 @@ export default class MainBackground {
|
|||||||
id: 'autofill_' + idSuffix,
|
id: 'autofill_' + idSuffix,
|
||||||
parentId: 'autofill',
|
parentId: 'autofill',
|
||||||
contexts: ['all'],
|
contexts: ['all'],
|
||||||
title: title,
|
title: this.sanitizeContextMenuTitle(title),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -570,7 +570,7 @@ export default class MainBackground {
|
|||||||
id: 'copy-username_' + idSuffix,
|
id: 'copy-username_' + idSuffix,
|
||||||
parentId: 'copy-username',
|
parentId: 'copy-username',
|
||||||
contexts: ['all'],
|
contexts: ['all'],
|
||||||
title: title,
|
title: this.sanitizeContextMenuTitle(title),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -580,7 +580,7 @@ export default class MainBackground {
|
|||||||
id: 'copy-password_' + idSuffix,
|
id: 'copy-password_' + idSuffix,
|
||||||
parentId: 'copy-password',
|
parentId: 'copy-password',
|
||||||
contexts: ['all'],
|
contexts: ['all'],
|
||||||
title: title,
|
title: this.sanitizeContextMenuTitle(title),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -590,11 +590,15 @@ export default class MainBackground {
|
|||||||
id: 'copy-totp_' + idSuffix,
|
id: 'copy-totp_' + idSuffix,
|
||||||
parentId: 'copy-totp',
|
parentId: 'copy-totp',
|
||||||
contexts: ['all'],
|
contexts: ['all'],
|
||||||
title: title,
|
title: this.sanitizeContextMenuTitle(title),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private sanitizeContextMenuTitle(title: string): string {
|
||||||
|
return title.replace(/&/g, '&&');
|
||||||
|
}
|
||||||
|
|
||||||
private cleanupNotificationQueue() {
|
private cleanupNotificationQueue() {
|
||||||
for (let i = this.notificationQueue.length - 1; i >= 0; i--) {
|
for (let i = this.notificationQueue.length - 1; i >= 0; i--) {
|
||||||
if (this.notificationQueue[i].expires < new Date()) {
|
if (this.notificationQueue[i].expires < new Date()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user