mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Merge from vscode cfbd1999769f4f08dce29629fb92fdc0fac53829
This commit is contained in:
@@ -99,7 +99,9 @@ function normalizeRequestPath(requestUri: URI) {
|
||||
//
|
||||
// vscode-webview-resource://id/scheme//authority?/path
|
||||
//
|
||||
const resourceUri = URI.parse(requestUri.path.replace(/^\/([a-z0-9\-]+)(\/{1,2})/i, (_: string, scheme: string, sep: string) => {
|
||||
|
||||
// Encode requestUri.path so that URI.parse can properly parse special characters like '#', '?', etc.
|
||||
const resourceUri = URI.parse(encodeURIComponent(requestUri.path).replace(/%2F/gi, '/').replace(/^\/([a-z0-9\-]+)(\/{1,2})/i, (_: string, scheme: string, sep: string) => {
|
||||
if (sep.length === 1) {
|
||||
return `${scheme}:///`; // Add empty authority.
|
||||
} else {
|
||||
|
||||
@@ -27,7 +27,7 @@ export class WebviewPortMappingManager implements IDisposable {
|
||||
private readonly tunnelService: ITunnelService
|
||||
) { }
|
||||
|
||||
public async getRedirect(resolveAuthority: IAddress, url: string): Promise<string | undefined> {
|
||||
public async getRedirect(resolveAuthority: IAddress | null | undefined, url: string): Promise<string | undefined> {
|
||||
const uri = URI.parse(url);
|
||||
const requestLocalHostInfo = extractLocalHostUriMetaDataForPortMapping(uri);
|
||||
if (!requestLocalHostInfo) {
|
||||
@@ -38,7 +38,7 @@ export class WebviewPortMappingManager implements IDisposable {
|
||||
if (mapping.webviewPort === requestLocalHostInfo.port) {
|
||||
const extensionLocation = this._getExtensionLocation();
|
||||
if (extensionLocation && extensionLocation.scheme === REMOTE_HOST_SCHEME) {
|
||||
const tunnel = await this.getOrCreateTunnel(resolveAuthority, mapping.extensionHostPort);
|
||||
const tunnel = resolveAuthority && await this.getOrCreateTunnel(resolveAuthority, mapping.extensionHostPort);
|
||||
if (tunnel) {
|
||||
if (tunnel.tunnelLocalPort === mapping.webviewPort) {
|
||||
return undefined;
|
||||
|
||||
Reference in New Issue
Block a user