Fix exception when URL has two trailing slashes
This commit is contained in:
1 parent
24cd3f5670
commit
227a005400
1 file changed
+8
@@ -45,6 +45,10 @@ koa.on("error", (err, ctx) => {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
// Ignored errors resulting from aborted requests
|
// Ignored errors resulting from aborted requests
|
||||||
if (ctx?.req.aborted) return;
|
if (ctx?.req.aborted) return;
|
||||||
|
|
||||||
|
// Ignore client errors (e.g. malicious path)
|
||||||
|
if (err.status === 400) return;
|
||||||
|
|
||||||
throw err;
|
throw err;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -203,6 +207,10 @@ router.post("/init", async (ctx) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
router.get("/", async (ctx) => {
|
router.get("/", async (ctx) => {
|
||||||
|
// koa-router seems to tolerate double slashes in the URL but that can
|
||||||
|
// be problematic when using relatives asset paths in HTML
|
||||||
|
if (ctx.path.endsWith("//")) return;
|
||||||
|
|
||||||
const permissionSets: PermissionSet[] =
|
const permissionSets: PermissionSet[] =
|
||||||
ctx.state.authorizer.getPermissionSets();
|
ctx.state.authorizer.getPermissionSets();
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user