File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,6 +16,12 @@ module.exports.builder = function(yargs) {
1616 , type : 'string'
1717 , demand : true
1818 } )
19+ . option ( 'max-file-size' , {
20+ describe : 'Maximum file size to allow for uploads. Note that nginx ' +
21+ 'may have a separate limit, meaning you should change both.'
22+ , type : 'number'
23+ , default : 1 * 1024 * 1024 * 1024
24+ } )
1925 . option ( 'port' , {
2026 alias : 'p'
2127 , describe : 'The port to bind to.'
@@ -39,5 +45,6 @@ module.exports.handler = function(argv) {
3945 , profile : argv . profile
4046 , bucket : argv . bucket
4147 , endpoint : argv . endpoint
48+ , maxFileSize : argv . maxFileSize
4249 } )
4350}
Original file line number Diff line number Diff line change @@ -8,6 +8,12 @@ module.exports.builder = function(yargs) {
88 return yargs
99 . env ( 'STF_STORAGE_TEMP' )
1010 . strict ( )
11+ . option ( 'max-file-size' , {
12+ describe : 'Maximum file size to allow for uploads. Note that nginx ' +
13+ 'may have a separate limit, meaning you should change both.'
14+ , type : 'number'
15+ , default : 1 * 1024 * 1024 * 1024
16+ } )
1117 . option ( 'port' , {
1218 alias : 'p'
1319 , describe : 'The port to bind to.'
@@ -29,5 +35,6 @@ module.exports.handler = function(argv) {
2935 return require ( '../../units/storage/temp' ) ( {
3036 port : argv . port
3137 , saveDir : argv . saveDir
38+ , maxFileSize : argv . maxFileSize
3239 } )
3340}
Original file line number Diff line number Diff line change @@ -72,7 +72,9 @@ module.exports = function(options) {
7272 }
7373
7474 app . post ( '/s/upload/:plugin' , function ( req , res ) {
75- var form = new formidable . IncomingForm ( )
75+ var form = new formidable . IncomingForm ( {
76+ maxFileSize : options . maxFileSize
77+ } )
7678 var plugin = req . params . plugin
7779 Promise . promisify ( form . parse , form ) ( req )
7880 . spread ( function ( fields , files ) {
Original file line number Diff line number Diff line change @@ -83,7 +83,9 @@ module.exports = function(options) {
8383 } )
8484
8585 app . post ( '/s/upload/:plugin' , function ( req , res ) {
86- var form = new formidable . IncomingForm ( )
86+ var form = new formidable . IncomingForm ( {
87+ maxFileSize : options . maxFileSize
88+ } )
8789 if ( options . saveDir ) {
8890 form . uploadDir = options . saveDir
8991 }
You can’t perform that action at this time.
0 commit comments