From 804f83828f9b0781e42d053777d7fc3c050fb5e6 Mon Sep 17 00:00:00 2001 From: Crystal Tenn Date: Tue, 18 Apr 2023 17:30:53 -0400 Subject: [PATCH] fix path reference for reusable workflows and use vscodeURI instead --- languageserver/src/file-provider.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/languageserver/src/file-provider.ts b/languageserver/src/file-provider.ts index cc0ceec..8722901 100644 --- a/languageserver/src/file-provider.ts +++ b/languageserver/src/file-provider.ts @@ -4,6 +4,7 @@ import {fileIdentifier} from "@actions/workflow-parser/workflows/file-reference" import {Octokit} from "@octokit/rest"; import path from "path"; import {TTLCache} from "./utils/cache"; +import vscodeURI from "vscode-uri/lib/umd"; // work around issues with the vscode-uri package export function getFileProvider( client: Octokit | undefined, @@ -31,7 +32,10 @@ export function getFileProvider( throw new Error("Local file references are not supported with this configuration"); } - const file = await readFile(path.join(workspace, ref.path)); + const workspaceURI = vscodeURI.URI.parse(workspace); + const path = vscodeURI.Utils.joinPath(workspaceURI, ref.path); + const file = await readFile(path.toString()); + if (!file) { throw new Error(`File not found: ${ref.path}`); }