summaryrefslogtreecommitdiff
path: root/node/db
diff options
context:
space:
mode:
authorPeter 'Pita' Martischka <petermartischka@googlemail.com>2011-08-04 16:07:58 +0100
committerPeter 'Pita' Martischka <petermartischka@googlemail.com>2011-08-04 16:07:58 +0100
commit820c18c7e90b3184f63766ecd5f5ebf8cf1aec5c (patch)
tree850d1cd3ebac1238a96ab99d15c9e4f159e8763e /node/db
parentf45b7ce9ead53215eb8f63ab744361ae3f6057f2 (diff)
downloadetherpad-lite-820c18c7e90b3184f63766ecd5f5ebf8cf1aec5c.zip
check the padID with a regular expression
Diffstat (limited to 'node/db')
-rw-r--r--node/db/PadManager.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/node/db/PadManager.js b/node/db/PadManager.js
index 4fada2c5..ff39849f 100644
--- a/node/db/PadManager.js
+++ b/node/db/PadManager.js
@@ -33,6 +33,9 @@ globalPads = [];
*/
exports.getPad = function(id, callback)
{
+ if(!exports.isValidPadId(id))
+ throw new Error(id + " is not a valid padId");
+
var pad = globalPads[id];
//return pad if its already loaded
@@ -69,3 +72,9 @@ exports.doesPadExists = function(padId, callback)
callback(err, value != null);
});
}
+
+exports.isValidPadId = function(padId)
+{
+ return /^([0-9]+\$)?[^$]{1,50}$/.test(padId);
+}
+