From 92542e3ee4d52ca7622240add9d4d29218472999 Mon Sep 17 00:00:00 2001 From: Sanjana Rajan Date: Thu, 26 Apr 2018 13:19:02 -0700 Subject: [PATCH] fix #636 --- src/encoding/armor.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/encoding/armor.js b/src/encoding/armor.js index def2ccf1..92b58923 100644 --- a/src/encoding/armor.js +++ b/src/encoding/armor.js @@ -257,12 +257,12 @@ function splitChecksum(text) { function dearmor(text) { const reSplit = /^-----[^-]+-----$\n/m; - // remove trailing whitespace at end of line - text = text.replace(/[\t\r ]+\n/g, '\n'); + // trim string and remove trailing whitespace at end of lines + text = text.trim().replace(/[\t\r ]+\n/g, '\n'); const type = getType(text); - text = text.trim() + "\n"; + text = text + "\n"; const splittext = text.split(reSplit); // IE has a bug in split with a re. If the pattern matches the beginning of the