From 1fb6eb166c3f6938361e91f986243a56d32d87e9 Mon Sep 17 00:00:00 2001 From: lowlighter <22963968+lowlighter@users.noreply.github.com> Date: Wed, 14 Apr 2021 18:52:56 +0200 Subject: [PATCH] Fix CodeQL errors --- source/app/web/instance.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/app/web/instance.mjs b/source/app/web/instance.mjs index 5b68c48f..92d57353 100644 --- a/source/app/web/instance.mjs +++ b/source/app/web/instance.mjs @@ -200,7 +200,7 @@ //GitHub failed request if ((error instanceof Error)&&(/this may be the result of a timeout, or it could be a GitHub bug/i.test(error.errors?.[0]?.message))) { console.debug(`metrics/app/${login} > 502 (bad gateway from GitHub)`) - const {request} = error.errors[0].message.match(/`(?[\w:]+)`/)?.groups ?? null + const request = encodeURIComponent(error.errors[0].message.match(/`(?[\w:]+)`/)?.groups?.request ?? "").replace(/%3A/g, ":") return res.status(502).send(`Bad Gateway: GitHub failed to execute request ${request} (this may be the result of a timeout, or it could be a GitHub bug)`) } //General error @@ -288,7 +288,7 @@ //GitHub failed request if ((error instanceof Error)&&(/this may be the result of a timeout, or it could be a GitHub bug/i.test(error.errors?.[0]?.message))) { console.debug(`metrics/app/${login} > 502 (bad gateway from GitHub)`) - const {request} = error.errors[0].message.match(/`(?[\w:]+)`/)?.groups ?? null + const request = encodeURIComponent(error.errors[0].message.match(/`(?[\w:]+)`/)?.groups?.request ?? "").replace(/%3A/g, ":") return res.status(502).send(`Bad Gateway: GitHub failed to execute request ${request} (this may be the result of a timeout, or it could be a GitHub bug)`) } //General error