From 74684f24c663af12c88b196fecd5f44863b893e4 Mon Sep 17 00:00:00 2001 From: Maximilian Krambach Date: Fri, 17 Aug 2018 19:20:35 +0200 Subject: js: decode arriving gpg message strings -- * Arriving strings (i.e. user id names, error messages) are not always in javascript encoding. This is an attempt to go through the whole gpgme answer (with the exception of payload data) and to fix the encoding of these --- lang/js/src/Connection.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lang/js/src/Connection.js') diff --git a/lang/js/src/Connection.js b/lang/js/src/Connection.js index b0105757..8d381f15 100644 --- a/lang/js/src/Connection.js +++ b/lang/js/src/Connection.js @@ -26,6 +26,7 @@ import { permittedOperations } from './permittedOperations'; import { gpgme_error } from './Errors'; import { GPGME_Message, createMessage } from './Message'; +import { decode } from './Helpers'; /** * A Connection handles the nativeMessaging interaction via a port. As the @@ -239,7 +240,7 @@ class Answer{ case 'type': if (_decodedResponse.type === 'error'){ return (gpgme_error('GNUPG_ERROR', - decodeURIComponent(escape(_decodedResponse.msg)))); + decode(_decodedResponse.msg))); } else if (poa.type.indexOf(_decodedResponse.type) < 0){ return gpgme_error('CONN_UNEXPECTED_ANSWER'); } @@ -270,7 +271,7 @@ class Answer{ ('00' + c.charCodeAt(0).toString(16)).slice(-2); }).join('')); } else { - _response[key] = _decodedResponse[key]; + _response[key] = decode(_decodedResponse[key]); } break; } -- cgit v1.2.3