From 54ef6484e7bfd58fe8f70a852bba312cbab291e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jochen=20K=C3=BChner?= Date: Fri, 3 Jan 2025 10:30:56 +0100 Subject: [PATCH 1/2] support data URI's --- extensions/media-preview/src/imagePreview/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extensions/media-preview/src/imagePreview/index.ts b/extensions/media-preview/src/imagePreview/index.ts index e0c605c2a6e25..622bfeac1813c 100644 --- a/extensions/media-preview/src/imagePreview/index.ts +++ b/extensions/media-preview/src/imagePreview/index.ts @@ -197,6 +197,8 @@ class ImagePreview extends MediaPreview { } private async getResourcePath(webviewEditor: vscode.WebviewPanel, resource: vscode.Uri, version: string): Promise { + if (resource.scheme === 'data') + return decodeURIComponent(resource.toString()); if (resource.scheme === 'git') { const stat = await vscode.workspace.fs.stat(resource); if (stat.size === 0) { From 7b55a3164c0bc8cd46fa1289f4c1fc15dba18ca8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jochen=20K=C3=BChner?= Date: Fri, 3 Jan 2025 19:40:35 +0100 Subject: [PATCH 2/2] fix eslint --- extensions/media-preview/src/imagePreview/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extensions/media-preview/src/imagePreview/index.ts b/extensions/media-preview/src/imagePreview/index.ts index 622bfeac1813c..c32824da167b9 100644 --- a/extensions/media-preview/src/imagePreview/index.ts +++ b/extensions/media-preview/src/imagePreview/index.ts @@ -197,8 +197,9 @@ class ImagePreview extends MediaPreview { } private async getResourcePath(webviewEditor: vscode.WebviewPanel, resource: vscode.Uri, version: string): Promise { - if (resource.scheme === 'data') + if (resource.scheme === 'data') { return decodeURIComponent(resource.toString()); + } if (resource.scheme === 'git') { const stat = await vscode.workspace.fs.stat(resource); if (stat.size === 0) {