mirror of
https://github.com/overleaf/overleaf.git
synced 2025-01-30 18:50:47 +00:00
First pass at encoding changes & comments in ranges
This commit is contained in:
parent
72ef354206
commit
9f503f1e9f
1 changed files with 24 additions and 0 deletions
|
@ -101,6 +101,30 @@ module.exports = WebsocketController =
|
|||
logger.err {err, project_id, doc_id, fromVersion, line, client_id: client.id}, "error encoding line uri component"
|
||||
return callback(err)
|
||||
escapedLines.push line
|
||||
|
||||
if ranges.comments
|
||||
escapedComments = []
|
||||
for comment in ranges.comments
|
||||
try
|
||||
comment.op.c = unescape(encodeURIComponent(comment.op.c))
|
||||
catch err
|
||||
logger.err {err, project_id, doc_id, fromVersion, comment, client_id: client.id}, "error encoding comment uri component"
|
||||
return callback(err)
|
||||
escapedComments.push comment
|
||||
ranges.comments = escapedComments
|
||||
|
||||
if ranges.changes
|
||||
escapedChanges = []
|
||||
for change in ranges.changes
|
||||
try
|
||||
change.op.i = unescape(encodeURIComponent(change.op.i)) if change.op.i
|
||||
change.op.d = unescape(encodeURIComponent(change.op.d)) if change.op.d
|
||||
catch err
|
||||
logger.err {err, project_id, doc_id, fromVersion, change, client_id: client.id}, "error encoding change uri component"
|
||||
return callback(err)
|
||||
escapedChanges.push change
|
||||
ranges.changes = escapedChanges
|
||||
|
||||
AuthorizationManager.addAccessToDoc client, doc_id
|
||||
client.join(doc_id)
|
||||
callback null, escapedLines, version, ops, ranges
|
||||
|
|
Loading…
Reference in a new issue