in packages/vscode-extension-web-ide/src/thirdPartyExtensions/redhatVscodeYaml.ts [28:47]
async function getWebIdeCompatibleUri(uriStr: string): Promise<vscode.Uri> {
const uriArg = vscode.Uri.parse(uriStr);
if (!RECOGNIZED_SCHEMES.includes(uriArg.scheme)) {
log.error(`Unrecognized scheme ${uriArg.scheme}`);
throw Error(`Unrecognized scheme ${uriArg.scheme}`);
}
const { repoRoot } = await getConfig();
// Somehow, when a remote schema is present the `uriStr` passed is translated to `gitlab-web-ide:/~/path/to/file.json`
// This leads to incorrect parsing of the Uri (`~` is included as a path) causing it to fail when attempting to read the file.
// Let's remove this `~` if it exists and is in the beginning of the path.
const pathNoTilde = uriArg.path.replace(/^\/~/, '');
return vscode.Uri.from({
scheme: FS_SCHEME,
path: joinPaths('/', repoRoot, pathNoTilde),
});
}