Skip to content

support data URI's in image preview#237222

Open
jogibear9988 wants to merge 3 commits intomicrosoft:mainfrom
jogibear9988:svg-datauri
Open

support data URI's in image preview#237222
jogibear9988 wants to merge 3 commits intomicrosoft:mainfrom
jogibear9988:svg-datauri

Conversation

@jogibear9988
Copy link
Contributor

support data URI's for image preview

fixes #237220

@jogibear9988
Copy link
Contributor Author

It works, but the URI is used as the filename:

image

Is there a way to change this? I open via

				let img = vscode.Uri.parse('data:image/svg+xml;base64,' + itemResult.data);
				await vscode.commands.executeCommand('vscode.openWith', img, 'imagePreview.previewEditor');


private async getResourcePath(webviewEditor: vscode.WebviewPanel, resource: vscode.Uri, version: string): Promise<string> {
if (resource.scheme === 'data') {
return decodeURIComponent(resource.toString());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think decoding should be needed. If it is, there's likely a bug somewhere else that needs to be fixed

@mjbvz mjbvz added this to the April 2025 milestone Mar 28, 2025
@mjbvz mjbvz modified the milestones: April 2025, May 2025 Apr 29, 2025
@mjbvz mjbvz modified the milestones: May 2025, June 2025 May 23, 2025
@mjbvz mjbvz modified the milestones: June 2025, July 2025 Jul 1, 2025
@mjbvz mjbvz modified the milestones: July 2025, August 2025 Jul 30, 2025
@mjbvz mjbvz modified the milestones: August 2025, September 2025 Sep 2, 2025
@mjbvz mjbvz modified the milestones: September 2025, October 2025 Sep 29, 2025
@mjbvz mjbvz modified the milestones: October 2025, November 2025 Nov 4, 2025
@bpasero bpasero modified the milestones: December 2025, January 2026 Jan 20, 2026
@mjbvz mjbvz modified the milestones: January 2026, February 2026 Jan 30, 2026
@rzhao271 rzhao271 modified the milestones: February 2026, March 2026 Feb 27, 2026
@mjbvz mjbvz modified the milestones: 1.111.0, 1.112.0 Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support data URI's in image preview, so it could be used from extensions

4 participants