summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChristoph (Sheogorath) Kern2018-06-24 01:57:47 +0200
committerGitHub2018-06-24 01:57:47 +0200
commitcfdfafdb79a5b6f7d5b193b05aad1a16c1900f8f (patch)
tree31d892798e2ce0aa72e4088d68a12e457e8add68 /lib
parentec78c4f2fc2eead9d7a4c0126172253f935a6e57 (diff)
parentb7b621822c518f659f775343332945bc545cb094 (diff)
Merge pull request #856 from hackmdio/fix/lineEndings
Fix possible line-ending issues for init note
Diffstat (limited to '')
-rw-r--r--lib/response.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/response.js b/lib/response.js
index a3c988fc..d1e5e15c 100644
--- a/lib/response.js
+++ b/lib/response.js
@@ -145,6 +145,8 @@ function responseHackMD (res, note) {
function newNote (req, res, next) {
var owner = null
+ var body = req.body ? req.body : ''
+ body = body.replace(/[\r]/g, '')
if (req.isAuthenticated()) {
owner = req.user.id
} else if (!config.allowAnonymous) {
@@ -153,7 +155,7 @@ function newNote (req, res, next) {
models.Note.create({
ownerId: owner,
alias: req.alias ? req.alias : null,
- content: req.body ? req.body : ''
+ content: body
}).then(function (note) {
return res.redirect(config.serverURL + '/' + models.Note.encodeNoteId(note.id))
}).catch(function (err) {