mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-06 07:39:02 +02:00
null byte check for JSON.stringify in archiving
This commit is contained in:
@@ -46,6 +46,9 @@ module.exports = MongoAWS =
|
||||
return callback new Error("cannot find pack to send to s3") if not result?
|
||||
return callback new Error("refusing to send pack with TTL to s3") if result.expiresAt?
|
||||
uncompressedData = JSON.stringify(result)
|
||||
if uncompressedData.indexOf("\u0000") != -1
|
||||
error = new Error("null bytes found in upload")
|
||||
logger.error err: error, project_id: project_id, doc_id: doc_id, pack_id: pack_id, error.message
|
||||
zlib.gzip uncompressedData, (err, buf) ->
|
||||
logger.log {project_id, doc_id, pack_id, origSize: uncompressedData.length, newSize: buf.length}, "compressed pack"
|
||||
return callback(err) if err?
|
||||
|
||||
Reference in New Issue
Block a user