Skip to content

Commit 3eed931

Browse files
authored
Decode relative links in markdown notebook cells (microsoft#188211)
Fixes microsoft#188209
1 parent f503e53 commit 3eed931

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,8 @@ export class BackLayerWebView<T extends ICommonCellInfo> extends Themable {
767767
const uri = URI.parse(data.href);
768768
this._handleNotebookCellResource(uri);
769769
} else if (!/^[\w\-]+:/.test(data.href)) {
770-
this._handleResourceOpening(data.href);
770+
// Uri without scheme, such as a file path
771+
this._handleResourceOpening(tryDecodeURIComponent(data.href));
771772
} else {
772773
// uri with scheme
773774
if (osPath.isAbsolute(data.href)) {
@@ -1795,3 +1796,11 @@ function getTokenizationCss() {
17951796
const tokenizationCss = colorMap ? generateTokensCSSForColorMap(colorMap) : '';
17961797
return tokenizationCss;
17971798
}
1799+
1800+
function tryDecodeURIComponent(uri: string) {
1801+
try {
1802+
return decodeURIComponent(uri);
1803+
} catch {
1804+
return uri;
1805+
}
1806+
}

0 commit comments

Comments
 (0)