Fix missing uri parsing in json schema loading

pull/237275/head
Misode 2025-01-05 05:17:26 +01:00
parent aa6a38114c
commit 4cafefb526
1 changed files with 3 additions and 1 deletions

View File

@ -8,6 +8,7 @@ import { formatError } from '../utils/runner';
import { RequestService, RuntimeEnvironment, startServer } from '../jsonServer';
import { xhr, XHRResponse, configure as configureHttpRequests, getErrorStatusDescription } from 'request-light';
import { URI as Uri } from 'vscode-uri';
import { promises as fs } from 'fs';
import * as l10n from '@vscode/l10n';
@ -38,7 +39,8 @@ function getFileRequestService(): RequestService {
return {
async getContent(location: string, encoding?: BufferEncoding) {
try {
return (await fs.readFile(location, encoding)).toString();
const uri = Uri.parse(location);
return (await fs.readFile(uri.fsPath, encoding)).toString();
} catch (e) {
if (e.code === 'ENOENT') {
throw new Error(l10n.t('Schema not found: {0}', location));