mirror of
https://github.com/HeyPuter/puter
synced 2024-11-15 06:15:47 +00:00
Disallow negative size values
This commit is contained in:
parent
90463a0732
commit
1f6a2093fb
@ -220,6 +220,10 @@ module.exports = class APIError {
|
|||||||
status: 400,
|
status: 400,
|
||||||
message: 'Missing fileinfo entry or BLOB for operation.',
|
message: 'Missing fileinfo entry or BLOB for operation.',
|
||||||
},
|
},
|
||||||
|
'invalid_file_metadata': {
|
||||||
|
status: 400,
|
||||||
|
message: 'Invalid file metadata.',
|
||||||
|
},
|
||||||
|
|
||||||
// Open
|
// Open
|
||||||
'no_suitable_app': {
|
'no_suitable_app': {
|
||||||
|
@ -192,7 +192,11 @@ module.exports = eggspress('/batch', {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( fieldname === 'fileinfo' ) {
|
if ( fieldname === 'fileinfo' ) {
|
||||||
fileinfos.push(JSON.parse(value));
|
const fileinfo = JSON.parse(value);
|
||||||
|
if ( fileinfo.size < 0 ) {
|
||||||
|
throw APIError.create('invalid_file_metadata');
|
||||||
|
}
|
||||||
|
fileinfos.push(fileinfo);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user