mirror of
https://github.com/timvisee/send.git
synced 2026-04-25 22:47:23 -04:00
extracted server id validation
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
function validateID(route_id) {
|
||||
return route_id.match(/^[0-9a-fA-F]{10}$/) !== null;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
middleware: function(req, res, next) {
|
||||
if (req.params.id && !validateID(req.params.id)) {
|
||||
return res.sendStatus(404);
|
||||
}
|
||||
next();
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user