From 188807087e72b781de28f79978994544d904347c Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Mon, 23 Aug 2021 15:46:42 -0700 Subject: [PATCH] Don't transform data uris Fixes #131256 --- src/vs/base/browser/markdownRenderer.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/vs/base/browser/markdownRenderer.ts b/src/vs/base/browser/markdownRenderer.ts index 3df342d1d6d..8f3a526b812 100644 --- a/src/vs/base/browser/markdownRenderer.ts +++ b/src/vs/base/browser/markdownRenderer.ts @@ -73,16 +73,19 @@ export function renderMarkdown(markdown: IMarkdownString, options: MarkdownRende return href; // no uri exists } let uri = URI.revive(data); + if (URI.parse(href).toString() === uri.toString()) { + return href; // no tranformation performed + } if (isDomUri) { + if (href.startsWith(Schemas.data + ':')) { + return href; + } // this URI will end up as "src"-attribute of a dom node // and because of that special rewriting needs to be done // so that the URI uses a protocol that's understood by // browsers (like http or https) return FileAccess.asBrowserUri(uri).toString(true); } - if (URI.parse(href).toString() === uri.toString()) { - return href; // no transformation performed - } if (uri.query) { uri = uri.with({ query: _uriMassage(uri.query) }); } @@ -275,7 +278,6 @@ function getInsaneOptions(options: { readonly isTrusted?: boolean }): InsaneOpti Schemas.mailto, Schemas.data, Schemas.file, - Schemas.vscodeFileResource, Schemas.vscodeRemote, Schemas.vscodeRemoteResource, ]; -- GitLab