mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 06:03:45 +01:00
First pass at encoding changes & comments in ranges
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user