mirror of
https://github.com/openstf/stf
synced 2025-10-04 10:19:30 +02:00
Newest version of formidable changes the default maximum file size to 2MB, which is way too low for anything. Make the limit configurable and set to 1GB by default.
This commit is contained in:
parent
e9d03aeac3
commit
4ed5aaacdb
4 changed files with 20 additions and 2 deletions
|
@ -16,6 +16,12 @@ module.exports.builder = function(yargs) {
|
|||
, type: 'string'
|
||||
, demand: true
|
||||
})
|
||||
.option('max-file-size', {
|
||||
describe: 'Maximum file size to allow for uploads. Note that nginx ' +
|
||||
'may have a separate limit, meaning you should change both.'
|
||||
, type: 'number'
|
||||
, default: 1 * 1024 * 1024 * 1024
|
||||
})
|
||||
.option('port', {
|
||||
alias: 'p'
|
||||
, describe: 'The port to bind to.'
|
||||
|
@ -39,5 +45,6 @@ module.exports.handler = function(argv) {
|
|||
, profile: argv.profile
|
||||
, bucket: argv.bucket
|
||||
, endpoint: argv.endpoint
|
||||
, maxFileSize: argv.maxFileSize
|
||||
})
|
||||
}
|
||||
|
|
|
@ -8,6 +8,12 @@ module.exports.builder = function(yargs) {
|
|||
return yargs
|
||||
.env('STF_STORAGE_TEMP')
|
||||
.strict()
|
||||
.option('max-file-size', {
|
||||
describe: 'Maximum file size to allow for uploads. Note that nginx ' +
|
||||
'may have a separate limit, meaning you should change both.'
|
||||
, type: 'number'
|
||||
, default: 1 * 1024 * 1024 * 1024
|
||||
})
|
||||
.option('port', {
|
||||
alias: 'p'
|
||||
, describe: 'The port to bind to.'
|
||||
|
@ -29,5 +35,6 @@ module.exports.handler = function(argv) {
|
|||
return require('../../units/storage/temp')({
|
||||
port: argv.port
|
||||
, saveDir: argv.saveDir
|
||||
, maxFileSize: argv.maxFileSize
|
||||
})
|
||||
}
|
||||
|
|
|
@ -72,7 +72,9 @@ module.exports = function(options) {
|
|||
}
|
||||
|
||||
app.post('/s/upload/:plugin', function(req, res) {
|
||||
var form = new formidable.IncomingForm()
|
||||
var form = new formidable.IncomingForm({
|
||||
maxFileSize: options.maxFileSize
|
||||
})
|
||||
var plugin = req.params.plugin
|
||||
Promise.promisify(form.parse, form)(req)
|
||||
.spread(function(fields, files) {
|
||||
|
|
|
@ -83,7 +83,9 @@ module.exports = function(options) {
|
|||
})
|
||||
|
||||
app.post('/s/upload/:plugin', function(req, res) {
|
||||
var form = new formidable.IncomingForm()
|
||||
var form = new formidable.IncomingForm({
|
||||
maxFileSize: options.maxFileSize
|
||||
})
|
||||
if (options.saveDir) {
|
||||
form.uploadDir = options.saveDir
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue