fix /data paths

This commit is contained in:
Stewart Allen 2020-06-01 22:21:45 -04:00
commit 2d2071b0fb

10
app.js
View file

@ -426,7 +426,7 @@ function handleData(req, res, next) {
addCorsHeaders(req, res); addCorsHeaders(req, res);
res.setHeader('Cache-Control', 'private, no-cache, max-age=0'); res.setHeader('Cache-Control', 'private, no-cache, max-age=0');
let tok = req.app.url.path.split('/'), let tok = req.app.path.split('/'),
muid = req.headers['x-moto-ajax'], muid = req.headers['x-moto-ajax'],
space = tok[2] || null, space = tok[2] || null,
version = tok[3], version = tok[3],
@ -474,11 +474,7 @@ function handleData(req, res, next) {
} else { } else {
db.get(countKey(space)).then(version => retrieve(version)); db.get(countKey(space)).then(version => retrieve(version));
} }
return;
} else if (valid && req.method === 'POST') { } else if (valid && req.method === 'POST') {
let dbOwner = null, let dbOwner = null,
dbVersion = null, dbVersion = null,
postBody = null, postBody = null,
@ -528,8 +524,8 @@ function handleData(req, res, next) {
dbVersion = parseInt(version || "0") + 1; dbVersion = parseInt(version || "0") + 1;
checkDone(); checkDone();
}); });
} else {
return; next();
} }
} }