Merge pull request #1940 from keepassxreboot/fix/handle_errors

Handle errors properly when waiting for response
This commit is contained in:
Sami Vänttinen 2023-08-08 09:31:07 +03:00 committed by GitHub
commit eb3657ead8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -83,7 +83,7 @@ keepassClient.sendNativeMessage = function(request, enableTimeout = false, timeo
const handler = (msg) => {
if (msg && msg?.action === action) {
// If the request has a separate requestID, check if it matches when there's no nonce (an error message)
const isNotificationOrError = !msg.nonce && request.requestID === msg.requestID;
const isNotificationOrError = !msg.nonce && (request.requestID === msg.requestID || (msg.error && msg.errorCode));
// Only resolve a matching response or a notification (without nonce)
if (isNotificationOrError || messageBuffer.matchAndRemove(msg)) {