Skip to content

Commit 7dee73b

Browse files
committed
Extensions - Properly copy project resources from extensions
Frequently, the render is happening from within the project directory, so the previous implementation would work. But if rendering from within a subfolder, that wouldn’t work - this fixes that. Fixes #8385
1 parent 71c6e09 commit 7dee73b

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/extension/extension.ts

+9-2
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,10 @@ export function createExtensionContext(): ExtensionContext {
140140
// _extensions/confluence/logo.png
141141
// will be copied and resolved to:
142142
// site_lib/quarto-contrib/quarto-project/confluence/logo.png
143-
export function projectExtensionPathResolver(libDir: string) {
143+
export function projectExtensionPathResolver(
144+
libDir: string,
145+
projectDir: string,
146+
) {
144147
return (href: string, projectOffset: string) => {
145148
const projectRelativeHref = relative(projectOffset, href);
146149

@@ -150,7 +153,11 @@ export function projectExtensionPathResolver(libDir: string) {
150153
`${libDir}/quarto-contrib/quarto-project/`,
151154
);
152155

153-
copyResourceFile(".", projectRelativeHref, projectTargetHref);
156+
copyResourceFile(
157+
projectDir,
158+
join(projectDir, projectRelativeHref),
159+
join(projectDir, projectTargetHref),
160+
);
154161
return join(projectOffset, projectTargetHref);
155162
}
156163

src/project/types/website/website.ts

+1
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ export const websiteProjectType: ProjectType = {
194194
project,
195195
projectExtensionPathResolver(
196196
project.config?.project[kProjectLibDir] || "",
197+
project.dir,
197198
),
198199
),
199200
]);

0 commit comments

Comments
 (0)