From f2363c9cc24db85aaa109392501d63248029a00e Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Tue, 23 Sep 2025 15:35:46 +0200 Subject: [PATCH 1/3] publish, connect - fix tar bundle creation using temp context --- src/deno_ral/tar.ts | 22 ++++++++++++++++------ src/publish/common/bundle.ts | 5 +---- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/deno_ral/tar.ts b/src/deno_ral/tar.ts index f9065c3a445..65e4bb2b0ac 100644 --- a/src/deno_ral/tar.ts +++ b/src/deno_ral/tar.ts @@ -6,36 +6,46 @@ * Abstraction layer over Deno's `tar` utilities. */ -import { TarStream, type TarStreamInput } from "jsr:@std/tar/tar-stream"; +import { TarStream, type TarStreamInput } from "tar/tar-stream"; +import { join } from "../deno_ral/path.ts"; /** * Creates a tar archive from the specified files and directories. * @param outputPath The path where the tar archive will be created. - * @param filePaths An array of file and directory paths to include in the tar archive. Paths are relative to outputPath. + * @param filePaths An array of file and directory paths to include in the tar archive. + * @param options Optional configuration for tar creation. + * @param options.baseDir Base directory for resolving relative paths in the archive. * @returns A promise that resolves when the tar archive is created. */ export async function createTarFromFiles( outputPath: string, filePaths: string[], + options?: { baseDir?: string }, ) { + const baseDir = options?.baseDir; + // Create array of TarStreamInput objects from file paths const inputs: TarStreamInput[] = await Promise.all( filePaths.map(async (path) => { - const stat = await Deno.stat(path); + const fullPath = baseDir ? join(baseDir, path) : path; + const stat = await Deno.stat(fullPath); + + // Use original path for archive, full path for reading + const archivePath = path; if (stat.isDirectory) { // Handle directory return { type: "directory", - path: path + (path.endsWith("/") ? "" : "/"), + path: archivePath + (archivePath.endsWith("/") ? "" : "/"), }; } else { // Handle file return { type: "file", - path: path, + path: archivePath, size: stat.size, - readable: (await Deno.open(path)).readable, + readable: (await Deno.open(fullPath)).readable, }; } }), diff --git a/src/publish/common/bundle.ts b/src/publish/common/bundle.ts index b3d2f70c80e..5d8c7c20a7a 100644 --- a/src/publish/common/bundle.ts +++ b/src/publish/common/bundle.ts @@ -10,10 +10,7 @@ import { ensureDirSync } from "../../deno_ral/fs.ts"; import { PublishFiles } from "../provider-types.ts"; import { TempContext } from "../../core/temp-types.ts"; import { md5HashBytes } from "../../core/hash.ts"; -import { pathWithForwardSlashes } from "../../core/path.ts"; -import { copy } from "io/copy"; -import { TarStream, type TarStreamInput } from "tar/tar-stream"; import { createTarFromFiles } from "../../deno_ral/tar.ts"; interface ManifestMetadata { @@ -110,7 +107,7 @@ export async function createBundle( // await copy(tar.getReader(), writer); // writer.close(); - await createTarFromFiles(tarFile, tarFiles); + await createTarFromFiles(tarFile, tarFiles, { baseDir: stageDir }); // compress to tar.gz const targzFile = `${tarFile}.gz`; From 64656b78fd62246b4929d5fd76b43ac7d4303013 Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Tue, 23 Sep 2025 16:37:21 +0200 Subject: [PATCH 2/3] Correctly normalize to forward slash the path when creating tar.gz for Connect deploys std/tar will create folders based on file paths used, but it requires using / and not \\ in path. This is a problem on Windows, where the path separator is \\. This commit normalize the path to use / instead of \\ when creating the tar.gz file for Connect deploys. --- src/deno_ral/tar.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/deno_ral/tar.ts b/src/deno_ral/tar.ts index 65e4bb2b0ac..522d9577c7c 100644 --- a/src/deno_ral/tar.ts +++ b/src/deno_ral/tar.ts @@ -8,6 +8,7 @@ import { TarStream, type TarStreamInput } from "tar/tar-stream"; import { join } from "../deno_ral/path.ts"; +import { pathWithForwardSlashes } from "../core/path.ts"; /** * Creates a tar archive from the specified files and directories. @@ -31,7 +32,7 @@ export async function createTarFromFiles( const stat = await Deno.stat(fullPath); // Use original path for archive, full path for reading - const archivePath = path; + const archivePath = pathWithForwardSlashes(path); if (stat.isDirectory) { // Handle directory From 139cc284446d62073991de08088688612b7ffb01 Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Wed, 24 Sep 2025 11:58:06 +0200 Subject: [PATCH 3/3] Add regression fix for quarto publish connect in changelog It has been backported to 1.8 --- news/changelog-1.9.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/news/changelog-1.9.md b/news/changelog-1.9.md index 08db84d9bce..238a1417364 100644 --- a/news/changelog-1.9.md +++ b/news/changelog-1.9.md @@ -1,7 +1,10 @@ All changes included in 1.9: +## Regression fixes + +- ([#13396](https://github.com/quarto-dev/quarto-cli/issues/13396)): Fix `quarto publish connect` regression. + ## Dependencies - Update `esbuild` to 0.25.10 - Update `deno` to 2.4.5 -