webaccess: Fix pad ID extraction for import and export paths

pull/4391/head
Richard Hansen 2020-10-01 21:29:38 -04:00 committed by John McLear
parent f4eae40c6b
commit ed6fcefb67
1 changed files with 1 additions and 1 deletions

View File

@ -64,7 +64,7 @@ exports.checkAccess = (req, res, next) => {
if (!level) return fail(); if (!level) return fail();
const user = req.session.user; const user = req.session.user;
if (user == null) return next(); // This will happen if authentication is not required. if (user == null) return next(); // This will happen if authentication is not required.
const encodedPadId = (req.path.match(/^\/p\/(.*)$/) || [])[1]; const encodedPadId = (req.path.match(/^\/p\/([^/]*)/) || [])[1];
if (encodedPadId == null) return next(); if (encodedPadId == null) return next();
const padId = decodeURIComponent(encodedPadId); const padId = decodeURIComponent(encodedPadId);
// The user was granted access to a pad. Remember the authorization level in the user's // The user was granted access to a pad. Remember the authorization level in the user's