mirror of
https://github.com/SonarSource/sonarqube-scan-action.git
synced 2026-07-14 18:52:59 +03:00
Fix from review
This commit is contained in:
Vendored
+3
-2
@@ -3997,7 +3997,8 @@ function convertToUnixPath(windowsPath) {
|
|||||||
function setupGpgHome() {
|
function setupGpgHome() {
|
||||||
const dirName = `gpg-${randomBytes(4).toString("hex")}`;
|
const dirName = `gpg-${randomBytes(4).toString("hex")}`;
|
||||||
|
|
||||||
for (const base of [process.env.RUNNER_TEMP, os$1.tmpdir()].filter(Boolean)) {
|
const runnertemp = process.env.RUNNER_TEMP;
|
||||||
|
for (const base of [runnertemp, os$1.tmpdir()].filter(Boolean)) {
|
||||||
const gpgHome = path$1.join(base, dirName);
|
const gpgHome = path$1.join(base, dirName);
|
||||||
if (process.platform === "win32" || (gpgHome + LONGEST_GPG_SOCKET).length <= MAX_GPG_SOCKET_PATH) {
|
if (process.platform === "win32" || (gpgHome + LONGEST_GPG_SOCKET).length <= MAX_GPG_SOCKET_PATH) {
|
||||||
fs$1.mkdirSync(gpgHome, { recursive: true, mode: 0o700 });
|
fs$1.mkdirSync(gpgHome, { recursive: true, mode: 0o700 });
|
||||||
@@ -4008,7 +4009,7 @@ function setupGpgHome() {
|
|||||||
throw new Error(
|
throw new Error(
|
||||||
`Cannot create a GPG home directory with a short enough path for GPG sockets. ` +
|
`Cannot create a GPG home directory with a short enough path for GPG sockets. ` +
|
||||||
`The longest socket path (gpgHome + "${LONGEST_GPG_SOCKET}") must not exceed ${MAX_GPG_SOCKET_PATH} characters. ` +
|
`The longest socket path (gpgHome + "${LONGEST_GPG_SOCKET}") must not exceed ${MAX_GPG_SOCKET_PATH} characters. ` +
|
||||||
`Consider setting RUNNER_TEMP to a shorter path.`
|
`Consider setting RUNNER_TEMP to a shorter path, was "${runnertemp || '<empty>'}".`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -557,7 +557,9 @@ describe("gpg-verification with mocked exec", () => {
|
|||||||
|
|
||||||
assert.throws(
|
assert.throws(
|
||||||
() => freshSetupGpgHome(),
|
() => freshSetupGpgHome(),
|
||||||
{ message: /Cannot create a GPG home directory/ }
|
{ message: `Cannot create a GPG home directory with a short enough path for GPG sockets. ` +
|
||||||
|
`The longest socket path (gpgHome + "/S.gpg-agent.browser") must not exceed 107 characters. ` +
|
||||||
|
`Consider setting RUNNER_TEMP to a shorter path, was "${longPath}".` }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -124,7 +124,8 @@ export function convertToUnixPath(windowsPath) {
|
|||||||
export function setupGpgHome() {
|
export function setupGpgHome() {
|
||||||
const dirName = `gpg-${randomBytes(4).toString("hex")}`;
|
const dirName = `gpg-${randomBytes(4).toString("hex")}`;
|
||||||
|
|
||||||
for (const base of [process.env.RUNNER_TEMP, os.tmpdir()].filter(Boolean)) {
|
const runnertemp = process.env.RUNNER_TEMP;
|
||||||
|
for (const base of [runnertemp, os.tmpdir()].filter(Boolean)) {
|
||||||
const gpgHome = path.join(base, dirName);
|
const gpgHome = path.join(base, dirName);
|
||||||
if (process.platform === "win32" || (gpgHome + LONGEST_GPG_SOCKET).length <= MAX_GPG_SOCKET_PATH) {
|
if (process.platform === "win32" || (gpgHome + LONGEST_GPG_SOCKET).length <= MAX_GPG_SOCKET_PATH) {
|
||||||
fs.mkdirSync(gpgHome, { recursive: true, mode: 0o700 });
|
fs.mkdirSync(gpgHome, { recursive: true, mode: 0o700 });
|
||||||
@@ -135,7 +136,7 @@ export function setupGpgHome() {
|
|||||||
throw new Error(
|
throw new Error(
|
||||||
`Cannot create a GPG home directory with a short enough path for GPG sockets. ` +
|
`Cannot create a GPG home directory with a short enough path for GPG sockets. ` +
|
||||||
`The longest socket path (gpgHome + "${LONGEST_GPG_SOCKET}") must not exceed ${MAX_GPG_SOCKET_PATH} characters. ` +
|
`The longest socket path (gpgHome + "${LONGEST_GPG_SOCKET}") must not exceed ${MAX_GPG_SOCKET_PATH} characters. ` +
|
||||||
`Consider setting RUNNER_TEMP to a shorter path.`
|
`Consider setting RUNNER_TEMP to a shorter path, was "${runnertemp || '<empty>'}".`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user