Add check for special url characters to createPad API function
parent
e1fe1f0f9c
commit
573a912e4f
|
@ -544,12 +544,21 @@ 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
|
||||||
getPadSafe(padID, false, text, function(err)
|
getPadSafe(padID, false, text, function(err)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue