Bug 1638537 - Follow-up, show error message in additional failure scenario. r=PatrickBrunschwig a=wsmwk
authorKai Engert <kaie@kuix.de>
Thu, 04 Jun 2020 18:02:55 +0200
changeset 39395 abe3463441023c7eeb1cbd5929eaeb6a89b11f2d
parent 39394 ab075b833c0ff991c1930bd40c4d8fc5180386db
child 39396 0e39b8506d47c922ce6dc9ef7cbfdb7e831d5722
push id402
push userclokep@gmail.com
push dateMon, 29 Jun 2020 20:48:04 +0000
reviewersPatrickBrunschwig, wsmwk
bugs1638537
Bug 1638537 - Follow-up, show error message in additional failure scenario. r=PatrickBrunschwig a=wsmwk Differential Revision: https://phabricator.services.mozilla.com/D78323
mail/extensions/openpgp/content/ui/commonWorkflows.js
--- a/mail/extensions/openpgp/content/ui/commonWorkflows.js
+++ b/mail/extensions/openpgp/content/ui/commonWorkflows.js
@@ -65,27 +65,26 @@ function EnigmailCommon_importKeysFromFi
   }
 
   // infile type: nsIFile
   // RNP.maxImportKeyBlockSize
   if (inFile.fileSize > 5000000) {
     EnigmailDialog.alert(window, EnigmailLocale.getString("fileToBigToImport"));
     return false;
   }
-
   let errorMsgObj = {};
   // preview
   let preview = EnigmailKey.getKeyListFromKeyFile(
     inFile,
     errorMsgObj,
     !secret,
     secret
   );
 
-  if (!preview || errorMsgObj.value) {
+  if (!preview || !preview.length || errorMsgObj.value) {
     EnigmailDialog.alert(
       window,
       EnigmailLocale.getString("importKeysFailed") + "\n\n" + errorMsgObj.value
     );
     return false;
   }
   let exitStatus = -1;