mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Fix file links not opening in Notebooks on Mac (#18202)
* convert vscode-file to file * update comment * check for undefined uri
This commit is contained in:
@@ -11,6 +11,7 @@ import { INotebookService } from 'sql/workbench/services/notebook/browser/notebo
|
|||||||
import { relative, resolve } from 'vs/base/common/path';
|
import { relative, resolve } from 'vs/base/common/path';
|
||||||
import { IFileService } from 'vs/platform/files/common/files';
|
import { IFileService } from 'vs/platform/files/common/files';
|
||||||
import { isWeb } from 'vs/base/common/platform';
|
import { isWeb } from 'vs/base/common/platform';
|
||||||
|
import { FileAccess } from 'vs/base/common/network';
|
||||||
|
|
||||||
const knownSchemes = new Set(['http', 'https', 'file', 'mailto', 'data', 'azuredatastudio', 'azuredatastudio-insiders', 'vscode', 'vscode-insiders', 'vscode-resource', 'onenote']);
|
const knownSchemes = new Set(['http', 'https', 'file', 'mailto', 'data', 'azuredatastudio', 'azuredatastudio-insiders', 'vscode', 'vscode-insiders', 'vscode-resource', 'onenote']);
|
||||||
@Directive({
|
@Directive({
|
||||||
@@ -71,7 +72,10 @@ export class LinkHandlerDirective {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (uri && this.openerService && this.isSupportedLink(uri)) {
|
if (uri && this.openerService) {
|
||||||
|
// Convert vscode-file protocol URIs to file since that's what Notebooks expect to work with
|
||||||
|
uri = FileAccess.asFileUri(uri);
|
||||||
|
if (this.isSupportedLink(uri)) {
|
||||||
if (uri.fragment && uri.fragment.length > 0 && uri.fsPath === this.workbenchFilePath.fsPath) {
|
if (uri.fragment && uri.fragment.length > 0 && uri.fsPath === this.workbenchFilePath.fsPath) {
|
||||||
this.notebookService.navigateTo(this.notebookUri, uri.fragment);
|
this.notebookService.navigateTo(this.notebookUri, uri.fragment);
|
||||||
} else {
|
} else {
|
||||||
@@ -96,6 +100,7 @@ export class LinkHandlerDirective {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private isSupportedLink(link: URI): boolean {
|
private isSupportedLink(link: URI): boolean {
|
||||||
if (knownSchemes.has(link.scheme)) {
|
if (knownSchemes.has(link.scheme)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user