fix: ensure includes are pulled in relative to their parent

This commit is contained in:
Andy Burke 2025-06-30 15:33:13 -07:00
parent 0f65e57539
commit 02c10aaa72
8 changed files with 9 additions and 8 deletions

View file

@ -25,7 +25,8 @@ async function load_html_with_ssi(html_file: string): Promise<string> {
async (_match, type, location, index): Promise<string | undefined> => {
switch (type) {
case 'file': {
const resolved = path.resolve(location);
const directory = path.dirname(html_file);
const resolved = path.resolve(path.join(directory, location));
if (!resolved.startsWith(Deno.cwd())) {
console.error(
`Cannot include files above the working directory (${Deno.cwd()}): ${location} ${html_file}:${index}`