parent
35b4380909
commit
5d71ae8691
|
@ -713,8 +713,11 @@ export default {
|
||||||
const indices = [];
|
const indices = [];
|
||||||
for (let i = 0; ; i = index) {
|
for (let i = 0; ; i = index) {
|
||||||
index = bytes.indexOf(LF, i) + 1;
|
index = bytes.indexOf(LF, i) + 1;
|
||||||
if (index && bytes[index - 2] !== CR) indices.push(index);
|
if (index) {
|
||||||
else break;
|
if (bytes[index - 2] !== CR) indices.push(index);
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!indices.length) {
|
if (!indices.length) {
|
||||||
return bytes;
|
return bytes;
|
||||||
|
|
|
@ -2487,6 +2487,20 @@ amnR6g==
|
||||||
expect(data).to.equal('Hello World!');
|
expect(data).to.equal('Hello World!');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should normalize newlines in encrypted text message', async function() {
|
||||||
|
const message = openpgp.message.fromText('"BEGIN:VCALENDAR\nVERSION:2.0\nBEGIN:VEVENT\r\nUID:123\r\nDTSTART:20191211T121212Z\r\nDTEND:20191212T121212Z\r\nEND:VEVENT\nEND:VCALENDAR"');
|
||||||
|
const encrypted = await openpgp.encrypt({
|
||||||
|
passwords: 'test',
|
||||||
|
message
|
||||||
|
});
|
||||||
|
const decrypted = await openpgp.decrypt({
|
||||||
|
passwords: 'test',
|
||||||
|
message: await openpgp.message.readArmored(encrypted.data),
|
||||||
|
format: 'binary'
|
||||||
|
});
|
||||||
|
expect(openpgp.util.decode_utf8(decrypted.data)).to.equal('"BEGIN:VCALENDAR\r\nVERSION:2.0\r\nBEGIN:VEVENT\r\nUID:123\r\nDTSTART:20191211T121212Z\r\nDTEND:20191212T121212Z\r\nEND:VEVENT\r\nEND:VCALENDAR"');
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Errors', function() {
|
describe('Errors', function() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user