Skip to content

POST to /new containing CRLF leads to unusable document #822

@azure9

Description

@azure9

when I follow the instruction in #673
curl -XPOST -H 'Content-Type: text/markdown' --data-binary "@public/docs/features.md" http://localhost:3000/new

It's done without error.
But when I try to edit this created document, it can't be edited, on server side it shows

app_1       | 2018-05-15T13:29:59.279Z - error:  Error: The operation's base length must be equal to the string's length.
app_1       |     at TextOperation.ot.TextOperation.TextOperation.apply (/hackmd/lib/ot/text-operation.js:184:13)
app_1       |     at WrappedOperation.ot.WrappedOperation.WrappedOperation.apply (/hackmd/lib/ot/wrapped-operation.js:16:31)
app_1       |     at EditorSocketIOServer.ot.Server.Server.receiveOperation (/hackmd/lib/ot/server.js:33:33)
app_1       |     at EditorSocketIOServer.onOperation (/hackmd/lib/ot/editor-socketio-server.js:107:33)
app_1       |     at /hackmd/lib/ot/editor-socketio-server.js:51:22
app_1       |     at EditorSocketIOServer.ifMayEdit [as mayWrite] (/hackmd/lib/realtime.js:659:10)
app_1       |     at Socket.<anonymous> (/hackmd/lib/ot/editor-socketio-server.js:45:14)
app_1       |     at emitThree (events.js:136:13)
app_1       |     at Socket.emit (events.js:217:7)
app_1       |     at /hackmd/node_modules/socket.io/lib/socket.js:513:12
app_1       |     at _combinedTickCallback (internal/process/next_tick.js:131:7)
app_1       |     at process._tickCallback (internal/process/next_tick.js:180:9)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions