Skip to content

Commit

Permalink
Merge pull request #263 from HHS/clamav-file-size-fix
Browse files Browse the repository at this point in the history
Increase max file size for scanned files
  • Loading branch information
rahearn authored Mar 26, 2021
2 parents b5298a2 + 3a48108 commit 2d20135
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down
7 changes: 6 additions & 1 deletion src/workers/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 2d20135

Please sign in to comment.