MCPcopy Index your code
hub / github.com/mailvelope/mailvelope / setAttachments

Method setAttachments

src/controller/editor.controller.js:324–339  ·  view source on GitHub ↗
(attachments)

Source from the content-addressed store, hash-verified

322 }
323
324 setAttachments(attachments) {
325 const encrypted = [];
326 const regex = /.*\.(gpg|pgp|asc)/;
327 for (const attachment of attachments) {
328 const content = dataURL2str(attachment.data);
329 if (regex.test(attachment.filename) && !/-----BEGIN\sPGP\sPUBLIC\sKEY\sBLOCK/.test(content)) {
330 encrypted.push(attachment);
331 } else {
332 this.ports.editor.emit('set-attachment', {attachment: {content, ...attachment}});
333 }
334 }
335 if (encrypted.length) {
336 this.ports.editor.emit('decrypt-in-progress');
337 this.decryptFiles(encrypted);
338 }
339 }
340
341 /**
342 * Decrypt armored message

Callers 1

onEditorOptionsMethod · 0.95

Calls 4

decryptFilesMethod · 0.95
dataURL2strFunction · 0.90
pushMethod · 0.45
emitMethod · 0.45

Tested by

no test coverage detected