diff --git a/docker-compose.yml b/docker-compose.yml index e48af8837c..f6ee8e90e2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -34,6 +34,8 @@ services: image: ajilaag/clamav-rest ports: - "9443:9443" + environment: + - MAX_FILE_SIZE=30M redis: image: redis:5.0.6-alpine command: ['redis-server', '--requirepass', '$REDIS_PASS'] diff --git a/src/workers/files.js b/src/workers/files.js index 30bc405626..453a0580b3 100644 --- a/src/workers/files.js +++ b/src/workers/files.js @@ -47,7 +47,12 @@ const processFile = async (key) => { form.append('name', key); form.append('file', data.Body, { filename: key, contentType: data.ContentType }); const agent = new https.Agent({ rejectUnauthorized: false }); - res = await axios.post(`${process.env.CLAMAV_ENDPOINT}/scan`, form, { httpsAgent: agent, headers: { ...form.getHeaders() } }); + res = await axios.post(`${process.env.CLAMAV_ENDPOINT}/scan`, form, { + httpsAgent: agent, + headers: { ...form.getHeaders() }, + // maxBodyLength: 30MB - matches MAX_FILE_SIZE on clamav application + maxBodyLength: 31457280, + }); await updateFileStatus(key, APPROVED); } catch (error) { if (error.response && error.response.status === 406) {