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,11 +544,20 @@ 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)
{
if(padID.indexOf("$") != -1)
{ {
callback(new customError("createPad can't create group pads","apierror")); callback(new customError("createPad can't create group pads","apierror"));
return; return;
} }
//check for url special characters
else if(padID.match(/(\/|\?|&|#)/))
{
callback(new customError("malformed padID: Remove special characters","apierror"));
return;
}
}
//create pad //create pad
getPadSafe(padID, false, text, function(err) getPadSafe(padID, false, text, function(err)