This commit is contained in:
the-djmaze 2022-10-12 23:08:28 +02:00
parent 063ed7d844
commit dc241ded1b
12 changed files with 18 additions and 16 deletions

View file

@ -1883,12 +1883,12 @@ var openpgp = (function (exports) {
},
/**
* Remove trailing spaces and tabs from each line
* Remove trailing spaces, carriage returns and tabs from each line
*/
removeTrailingSpaces(text) {
return text.split('\n').map(line => {
let i = line.length - 1;
for (; i >= 0 && (line[i] === ' ' || line[i] === '\t'); i--);
for (; i >= 0 && (line[i] === ' ' || line[i] === '\t' || line[i] === '\r'); i--);
return line.substr(0, i + 1);
}).join('\n');
},