js: Fix wrong encoding in received error messages

--

* The libgpg error strings arrive in the browser in a different
  encoding than used by browsers. Escaping and then decoding it
  should cover most languages in the supported browsers.
This commit is contained in:
Maximilian Krambach 2018-07-24 14:50:54 +02:00
parent a965e3e0b8
commit 040b1ed40a

View File

@ -240,7 +240,8 @@ class Answer{
switch (key) { switch (key) {
case 'type': case 'type':
if (_decodedResponse.type === 'error'){ if (_decodedResponse.type === 'error'){
return (gpgme_error('GNUPG_ERROR', _decodedResponse.msg)); return (gpgme_error('GNUPG_ERROR',
decodeURIComponent(escape(_decodedResponse.msg))));
} else if (poa.type.indexOf(_decodedResponse.type) < 0){ } else if (poa.type.indexOf(_decodedResponse.type) < 0){
return gpgme_error('CONN_UNEXPECTED_ANSWER'); return gpgme_error('CONN_UNEXPECTED_ANSWER');
} }