Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Larger csv exports buffer modification #3736

Open
wants to merge 1 commit into
base: release/v3.31.1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
}
cmd = `${cmd} ${csvTemplate ? `"${csvTemplate.headers.join(',')}"` : ''}`
log.debug("generate-csv: " + cmd)
exec(cmd).then(status => {
const maxBuffer = 1024 * 1024 * 100;
exec(cmd, { maxBuffer }).then(status => {

Check failure

Code scanning / CodeQL

Uncontrolled command line Critical

This command line depends on a
user-provided value
.
resolve(status)
}).catch(error => {
log.error("Error when exec-ing generate-csv: " + error)
Expand Down
4 changes: 3 additions & 1 deletion server/src/scripts/generate-csv/bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ async function go(state) {
// Run batches.
while (state.complete === false) {
log.debug(`Run batch at skip of ${state.skip} at statePath: ${state.statePath}`)
const response = await exec(`./batch.js '${state.statePath}'`)
const maxBuffer = 1024 * 1024 * 100; // 100MB
const response = await exec(`./batch.js '${state.statePath}'`, { maxBuffer });

if (response.stderr) console.error(response.stderr)
if (process.env.NODE_ENV === 'development') console.log(response)
state = JSON.parse(await readFile(state.statePath))
Expand Down
Loading