-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
POST to /new containing CRLF leads to unusable document #822
Comments
Can't really reproduce over here. Does it happen every time you do it or only once? (means it's gone when you reload or recreate the document) |
It happens every time when I use post /new api with --data-binary option, without the --data-binary option, the created document is editable, when I add this option, the problem shows. I use the image on docker-hub, test with latest docker image, the problem still exist. |
I just tried it with the docker image myself and still can't reproduce it. What browser are you using? What database backend are you using? |
you stated that it works without the |
I use chrome latest version and postgres as backend server, ubuntu 16.04 on server side, and config a nginx with websocket proxy to forward the requests to docker. I use docker image from https://github.com/hackmdio/docker-hackmd/blob/master/README.md and only changed the version to 2 to let ubuntu docker-compose work properly, settings are all default. |
Ah, I locate the root cause, when there's \r\n in the post content, the error shows up. |
I can't replicate the error. I created two files (one with LF, one with CRLF) and posted them like this:
Both ended up fine, they are indistinguishable. |
You just reproduce the bug, the bug is in https://hackmd-ce.herokuapp.com/G6kWT9iHRRqtFw0CZp1OYA When you trying to modify the content, the error shows up. |
You're right! Thanks for getting back to this. I can edit the first (LF only) but the second behaves weird (CRLF)! |
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
The text was updated successfully, but these errors were encountered: