Merge pull request #2302 from Gared/create_pad_special_characters

Add check for special url characters to createPad API function
This commit is contained in:
John McLear 2015-04-11 14:56:26 +01:00
commit 5ef22e649b
3 changed files with 36 additions and 6 deletions

View file

@ -687,12 +687,21 @@ Example returns:
exports.createPad = function(padID, text, callback)
{
//ensure there is no $ in the padID
if(padID && padID.indexOf("$") != -1)
if(padID)
{
callback(new customError("createPad can't create group pads","apierror"));
return;
if(padID.indexOf("$") != -1)
{
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
getPadSafe(padID, false, text, function(err)
{