summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Brinkmann <lebrinkma@gmail.com>2013-12-14 21:14:56 +0100
committerLennart Brinkmann <lebrinkma@gmail.com>2013-12-14 21:14:56 +0100
commitdd8af99e2e36e759fdc869c82a24a271742e2a5b (patch)
treef576cc53f136cb753506cd288fca870c789cc8c7 /src
parent7dd29454e9ccf69bf3683fd7de9d6d7c1bfbd19d (diff)
downloadetherpad-lite-dd8af99e2e36e759fdc869c82a24a271742e2a5b.zip
Add input validation for html param in setHTML()
Diffstat (limited to 'src')
-rw-r--r--src/node/db/API.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/node/db/API.js b/src/node/db/API.js
index 00be1918..98bc8029 100644
--- a/src/node/db/API.js
+++ b/src/node/db/API.js
@@ -382,8 +382,23 @@ exports.getHTML = function(padID, rev, callback)
});
}
+/**
+setHTML(padID, html) sets the text of a pad based on HTML
+
+Example returns:
+
+{code: 0, message:"ok", data: null}
+{code: 1, message:"padID does not exist", data: null}
+*/
exports.setHTML = function(padID, html, callback)
{
+ //html is required
+ if(typeof html != "string")
+ {
+ callback(new customError("html is no string","apierror"));
+ return;
+ }
+
//get the pad
getPadSafe(padID, true, function(err, pad)
{