Fix from review

This commit is contained in:
Alban Auzeill
2026-07-13 17:14:12 +02:00
parent 2dfea3d9ad
commit bc1610626e
4 changed files with 10 additions and 6 deletions
+3 -2
View File
@@ -3997,7 +3997,8 @@ function convertToUnixPath(windowsPath) {
function setupGpgHome() {
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);
if (process.platform === "win32" || (gpgHome + LONGEST_GPG_SOCKET).length <= MAX_GPG_SOCKET_PATH) {
fs$1.mkdirSync(gpgHome, { recursive: true, mode: 0o700 });
@@ -4008,7 +4009,7 @@ function setupGpgHome() {
throw new Error(
`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. ` +
`Consider setting RUNNER_TEMP to a shorter path.`
`Consider setting RUNNER_TEMP to a shorter path, was "${runnertemp || '<empty>'}".`
);
}
+1 -1
View File
File diff suppressed because one or more lines are too long
@@ -557,7 +557,9 @@ describe("gpg-verification with mocked exec", () => {
assert.throws(
() => 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}".` }
);
});
});
+3 -2
View File
@@ -124,7 +124,8 @@ export function convertToUnixPath(windowsPath) {
export function setupGpgHome() {
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);
if (process.platform === "win32" || (gpgHome + LONGEST_GPG_SOCKET).length <= MAX_GPG_SOCKET_PATH) {
fs.mkdirSync(gpgHome, { recursive: true, mode: 0o700 });
@@ -135,7 +136,7 @@ export function setupGpgHome() {
throw new Error(
`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. ` +
`Consider setting RUNNER_TEMP to a shorter path.`
`Consider setting RUNNER_TEMP to a shorter path, was "${runnertemp || '<empty>'}".`
);
}