Add input validation for html param in setHTML()
This commit is contained in:
parent
7dd29454e9
commit
dd8af99e2e
1 changed files with 15 additions and 0 deletions
|
@ -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)
|
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
|
//get the pad
|
||||||
getPadSafe(padID, true, function(err, pad)
|
getPadSafe(padID, true, function(err, pad)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue