extracted server id validation

This commit is contained in:
Danny Coates 2018-02-05 16:36:44 -08:00
parent 807c44f057
commit aae61f9451
No known key found for this signature in database
GPG key ID: 4C442633C62E00CB
15 changed files with 83 additions and 388 deletions

View file

@ -1,17 +1,8 @@
const storage = require('../storage');
function validateID(route_id) {
return route_id.match(/^[0-9a-fA-F]{10}$/) !== null;
}
module.exports = async function(req, res) {
const id = req.params.id;
if (!validateID(id)) {
res.sendStatus(404);
return;
}
const ownerToken = req.body.owner_token || req.body.delete_token;
if (!ownerToken) {