Skip to content

Commit

Permalink
Merge pull request #237275 from misode/fix-json-schema-parse-uri
Browse files Browse the repository at this point in the history
Fix missing uri to file path conversion when loading json schema
  • Loading branch information
aeschli authored Jan 7, 2025
2 parents b26ee64 + a3671f2 commit 0ae74f8
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit 0ae74f8

Please sign in to comment.