Add check for special url characters to createPad API function

This commit is contained in:
Stefan 2014-11-08 17:26:40 +01:00
parent e1fe1f0f9c
commit 573a912e4f

View file

@ -544,10 +544,19 @@ Example returns:
exports.createPad = function(padID, text, callback) exports.createPad = function(padID, text, callback)
{ {
//ensure there is no $ in the padID //ensure there is no $ in the padID
if(padID && padID.indexOf("$") != -1) if(padID)
{ {
callback(new customError("createPad can't create group pads","apierror")); if(padID.indexOf("$") != -1)
return; {
callback(new customError("createPad can't create group pads","apierror"));
return;
}
//check for url special characters
else if(padID.match(/(\/|\?|&|#)/))
{
callback(new customError("malformed padID: Remove special characters","apierror"));
return;
}
} }
//create pad //create pad