From f72c89cd71fe6bb8169ec64f2acb97a82d8259f7 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Tue, 18 Oct 2022 14:41:31 -0700 Subject: [PATCH] skipEncoding in URI.toString in fsExtension.ts Fixes #50 --- fs-provider/src/fsExtensionMain.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/fs-provider/src/fsExtensionMain.ts b/fs-provider/src/fsExtensionMain.ts index fe97ccb..3844dda 100644 --- a/fs-provider/src/fsExtensionMain.ts +++ b/fs-provider/src/fsExtensionMain.ts @@ -16,7 +16,7 @@ export function activate(context: ExtensionContext) { const disposable = workspace.registerFileSystemProvider(SCHEME, new MemFileSystemProvider(SCHEME, serverBackedRootDirectory)); context.subscriptions.push(disposable); - console.log(`vscode-test-web-support fs provider registers for ${SCHEME}, initial content from ${serverUri.toString()}`); + console.log(`vscode-test-web-support fs provider registers for ${SCHEME}, initial content from ${serverUri.toString(/*skipEncoding*/ true)}`); } class ServerBackedFile implements File { @@ -82,7 +82,7 @@ function isStat(e: any): e is FileStat { } async function getEntries(serverUri: Uri): Promise> { - const url = serverUri.with({ query: 'readdir' }).toString(); + const url = serverUri.with({ query: 'readdir' }).toString(/*skipEncoding*/ true); const response = await xhr({ url }); if (response.status === 200 && response.status <= 204) { try { @@ -101,30 +101,30 @@ async function getEntries(serverUri: Uri): Promise> { } catch { // ignore } - console.log(`Invalid server response format for ${url.toString()}.`); + console.log(`Invalid server response format for ${url.toString(/*skipEncoding*/ true)}.`); } else { - console.log(`Invalid server response for ${url.toString()}. Status ${response.status}`); + console.log(`Invalid server response for ${url.toString(/*skipEncoding*/ true)}. Status ${response.status}`); } return new Map(); } async function getStats(serverUri: Uri): Promise { - const url = serverUri.with({ query: 'stat' }).toString(); + const url = serverUri.with({ query: 'stat' }).toString(/*skipEncoding*/ true); const response = await xhr({ url }); if (response.status === 200 && response.status <= 204) { const res = JSON.parse(response.responseText); if (isStat(res)) { return res; } - throw FileSystemError.FileNotFound(`Invalid server response for ${serverUri.toString()}.`); + throw FileSystemError.FileNotFound(`Invalid server response for ${serverUri.toString(/*skipEncoding*/ true)}.`); } - throw FileSystemError.FileNotFound(`Invalid server response for ${serverUri.toString()}. Status ${response.status}.`); + throw FileSystemError.FileNotFound(`Invalid server response for ${serverUri.toString(/*skipEncoding*/ true)}. Status ${response.status}.`); } async function getContent(serverUri: Uri): Promise { - const response = await xhr({ url: serverUri.toString() }); + const response = await xhr({ url: serverUri.toString(/*skipEncoding*/ true) }); if (response.status >= 200 && response.status <= 204) { return response.body; } - throw FileSystemError.FileNotFound(`Invalid server response for ${serverUri.toString()}. Status ${response.status}.`); -} \ No newline at end of file + throw FileSystemError.FileNotFound(`Invalid server response for ${serverUri.toString(/*skipEncoding*/ true)}. Status ${response.status}.`); +}