mirror of
https://github.com/overleaf/overleaf.git
synced 2025-01-23 05:42:55 +00:00
Error if update would make document too long
This commit is contained in:
parent
03e9d7390f
commit
e73890bfc2
3 changed files with 6 additions and 1 deletions
|
@ -15,7 +15,7 @@ ShareJsModel:: = {}
|
|||
util.inherits ShareJsModel, EventEmitter
|
||||
|
||||
module.exports = ShareJsUpdateManager =
|
||||
getNewShareJsModel: () -> new ShareJsModel(ShareJsDB)
|
||||
getNewShareJsModel: () -> new ShareJsModel(ShareJsDB, maxDocLength: Settings.max_doc_length)
|
||||
|
||||
applyUpdates: (project_id, doc_id, updates, callback = (error, updatedDocLines) ->) ->
|
||||
logger.log project_id: project_id, doc_id: doc_id, updates: updates, "applying sharejs updates"
|
||||
|
|
|
@ -136,6 +136,9 @@ module.exports = Model = (db, options) ->
|
|||
catch error
|
||||
console.error error.stack
|
||||
return callback error.message
|
||||
|
||||
if options.maxDocLength? and doc.snapshot.length > options.maxDocLength
|
||||
return callback "Update takes doc over max doc size"
|
||||
|
||||
# The op data should be at the current version, and the new document data should be at
|
||||
# the next version.
|
||||
|
|
|
@ -23,6 +23,8 @@ module.exports =
|
|||
zip:
|
||||
minSize: 10*1024
|
||||
writesEnabled: false
|
||||
|
||||
max_doc_length: 2 * 1024 * 1024 # 2mb
|
||||
|
||||
mongo:
|
||||
url: 'mongodb://127.0.0.1/sharelatex'
|
||||
|
|
Loading…
Reference in a new issue