Skip to content

Commit 013f6e8

Browse files
authored
Merge pull request #13406 from quarto-dev/backport/rsconnect-tar-bundle
2 parents 1ca3dab + a6162b9 commit 013f6e8

File tree

3 files changed

+25
-11
lines changed

3 files changed

+25
-11
lines changed

news/changelog-1.8.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
All changes included in 1.8:
1+
# v1.9 backports
2+
3+
## In this release
4+
5+
- ([#13396](https://github.com/quarto-dev/quarto-cli/issues/13396)): Fix `quarto publish connect` regression.
6+
7+
# v1.8 changes
28

39
## Regression fixes
410

src/deno_ral/tar.ts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,47 @@
66
* Abstraction layer over Deno's `tar` utilities.
77
*/
88

9-
import { TarStream, type TarStreamInput } from "jsr:@std/tar/tar-stream";
9+
import { TarStream, type TarStreamInput } from "tar/tar-stream";
10+
import { join } from "../deno_ral/path.ts";
11+
import { pathWithForwardSlashes } from "../core/path.ts";
1012

1113
/**
1214
* Creates a tar archive from the specified files and directories.
1315
* @param outputPath The path where the tar archive will be created.
14-
* @param filePaths An array of file and directory paths to include in the tar archive. Paths are relative to outputPath.
16+
* @param filePaths An array of file and directory paths to include in the tar archive.
17+
* @param options Optional configuration for tar creation.
18+
* @param options.baseDir Base directory for resolving relative paths in the archive.
1519
* @returns A promise that resolves when the tar archive is created.
1620
*/
1721
export async function createTarFromFiles(
1822
outputPath: string,
1923
filePaths: string[],
24+
options?: { baseDir?: string },
2025
) {
26+
const baseDir = options?.baseDir;
27+
2128
// Create array of TarStreamInput objects from file paths
2229
const inputs: TarStreamInput[] = await Promise.all(
2330
filePaths.map(async (path) => {
24-
const stat = await Deno.stat(path);
31+
const fullPath = baseDir ? join(baseDir, path) : path;
32+
const stat = await Deno.stat(fullPath);
33+
34+
// Use original path for archive, full path for reading
35+
const archivePath = pathWithForwardSlashes(path);
2536

2637
if (stat.isDirectory) {
2738
// Handle directory
2839
return {
2940
type: "directory",
30-
path: path + (path.endsWith("/") ? "" : "/"),
41+
path: archivePath + (archivePath.endsWith("/") ? "" : "/"),
3142
};
3243
} else {
3344
// Handle file
3445
return {
3546
type: "file",
36-
path: path,
47+
path: archivePath,
3748
size: stat.size,
38-
readable: (await Deno.open(path)).readable,
49+
readable: (await Deno.open(fullPath)).readable,
3950
};
4051
}
4152
}),

src/publish/common/bundle.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ import { ensureDirSync } from "../../deno_ral/fs.ts";
1010
import { PublishFiles } from "../provider-types.ts";
1111
import { TempContext } from "../../core/temp-types.ts";
1212
import { md5HashBytes } from "../../core/hash.ts";
13-
import { pathWithForwardSlashes } from "../../core/path.ts";
1413

15-
import { copy } from "io/copy";
16-
import { TarStream, type TarStreamInput } from "tar/tar-stream";
1714
import { createTarFromFiles } from "../../deno_ral/tar.ts";
1815

1916
interface ManifestMetadata {
@@ -110,7 +107,7 @@ export async function createBundle(
110107
// await copy(tar.getReader(), writer);
111108
// writer.close();
112109

113-
await createTarFromFiles(tarFile, tarFiles);
110+
await createTarFromFiles(tarFile, tarFiles, { baseDir: stageDir });
114111

115112
// compress to tar.gz
116113
const targzFile = `${tarFile}.gz`;

0 commit comments

Comments
 (0)