[autofix.ci] apply automated fixes

This commit is contained in:
autofix-ci[bot]
2025-08-17 01:33:47 +00:00
committed by GitHub
parent f0278f354b
commit 81ab71ba23
@@ -12,11 +12,11 @@ export default async function handler(
} }
const gitlab = await findGitlabById(gitlabId as string); const gitlab = await findGitlabById(gitlabId as string);
const gitlabUrl = new URL(gitlab.gitlabUrl) const gitlabUrl = new URL(gitlab.gitlabUrl);
const headers: HeadersInit = { const headers: HeadersInit = {
"Content-Type": "application/x-www-form-urlencoded" "Content-Type": "application/x-www-form-urlencoded",
} };
// In case of basic auth being present in the URL, we need to remove it from the URL // In case of basic auth being present in the URL, we need to remove it from the URL
// and add it to the Authorization header. // and add it to the Authorization header.
@@ -24,13 +24,14 @@ export default async function handler(
headers.Authorization = `Basic ${Buffer.from(`${gitlabUrl.username}:${gitlabUrl.password}`).toString("base64")}`; headers.Authorization = `Basic ${Buffer.from(`${gitlabUrl.username}:${gitlabUrl.password}`).toString("base64")}`;
} }
const url = (gitlabUrl.username && gitlabUrl.password) const url =
? new URL(gitlabUrl, { gitlabUrl.username && gitlabUrl.password
...gitlabUrl, ? new URL(gitlabUrl, {
username: "", ...gitlabUrl,
password: "", username: "",
}).toString() password: "",
: gitlabUrl.toString(); }).toString()
: gitlabUrl.toString();
const response = await fetch(`${url}/oauth/token`, { const response = await fetch(`${url}/oauth/token`, {
method: "POST", method: "POST",