MCPcopy Create free account
hub / github.com/mailvelope/mailvelope / handleAddFile

Function handleAddFile

src/app/encrypt/Encrypt.js:217–233  ·  view source on GitHub ↗
(files)

Source from the content-addressed store, hash-verified

215 }
216
217 handleAddFile(files) {
218 files = Array.from(files);
219 const filesSize = files.reduce((total, file) => total + file.size, 0);
220 const uploadedSize = this.state.files.reduce((total, file) => total + file.size, 0);
221 const currentAttachmentsSize = uploadedSize + filesSize;
222 if (currentAttachmentsSize > MAX_FILE_UPLOAD_SIZE) {
223 this.setState({notifications: [{id: Date.now(), header: l10n.map.alert_header_error, message: `${l10n.map.upload_quota_exceeded_warning} ${Math.floor(MAX_FILE_UPLOAD_SIZE / (1024 * 1024))}MB.`, type: 'error'}]});
224 return;
225 }
226 for (const file of files) {
227 try {
228 this.addFile(file);
229 } catch (error) {
230 this.setErrorNotification(error, file.name, 'upload');
231 }
232 }
233 }
234
235 addFile(file) {
236 if (fileLib.isOversize(file)) {

Callers

nothing calls this directly

Calls 1

setStateMethod · 0.45

Tested by

no test coverage detected