Skip to content

Commit

Permalink
Fix #48403 broken images in markdown preview
Browse files Browse the repository at this point in the history
  • Loading branch information
lmcarreiro committed Jun 23, 2019
1 parent 3718e79 commit 616bac2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/vs/workbench/contrib/webview/common/resourceLoader.ts
Expand Up @@ -5,7 +5,7 @@

import { VSBuffer } from 'vs/base/common/buffer';
import { sep } from 'vs/base/common/path';
import { startsWith } from 'vs/base/common/strings';
import { startsWith, endsWith } from 'vs/base/common/strings';
import { URI } from 'vs/base/common/uri';
import { IFileService } from 'vs/platform/files/common/files';
import { REMOTE_HOST_SCHEME } from 'vs/platform/remote/common/remoteHosts';
Expand Down Expand Up @@ -45,10 +45,11 @@ export async function loadLocalResource(
extensionLocation: URI | undefined,
getRoots: () => ReadonlyArray<URI>
): Promise<LocalResourceResponse> {
const requestPath = requestUri.path;
const requestPath = requestUri.authority ? `//${requestUri.authority}${requestUri.path}` : requestUri.path;
const normalizedPath = URI.file(requestPath);
for (const root of getRoots()) {
if (!startsWith(normalizedPath.fsPath, root.fsPath + sep)) {
const rootPath = root.fsPath + (endsWith(root.fsPath, sep) ? '' : sep);
if (!startsWith(normalizedPath.fsPath, rootPath)) {
continue;
}

Expand Down

0 comments on commit 616bac2

Please sign in to comment.