Replace URL and use vscode.URI on local paths (#11624)

* Use vscode.URI for local paths

* Use vscode.uri file method to set the name for remotebookfull path compressed file

* Add await on extract tar function

* Replace remote paths too

* Use vscode.uri.file instead of parse for local paths
This commit is contained in:
Barbara Valdez
2020-08-04 13:22:28 -07:00
committed by GitHub
parent 9df51b9936
commit e7ec278ef2
6 changed files with 37 additions and 38 deletions

View File

@@ -7,6 +7,7 @@ import * as azdata from 'azdata';
import * as loc from '../common/localizedConstants';
import { RemoteBookController, IAsset } from '../book/remoteBookController';
import * as utils from '../common/utils';
import * as vscode from 'vscode';
const tigerToolboxRepo = 'repos/microsoft/tigertoolbox';
const urlGithubRE = /^(?:https:\/\/(?:github\.com|api\.github\.com\/repos)|(?:\/)?(?:\/)?repos)([\w-.?!=&%*+:@\/]*)/g;
@@ -185,7 +186,7 @@ export class RemoteBookDialog {
let groupsRe = url.match(urlGithubRE);
if (groupsRe?.length > 0) {
url = apiGitHub(groupsRe[0]);
let releases = await this.controller.getReleases(new URL(url));
let releases = await this.controller.getReleases(vscode.Uri.parse(url));
if (releases) {
this.releaseDropdown.enabled = true;
await this.fillReleasesDropdown();
@@ -232,7 +233,7 @@ export class RemoteBookDialog {
await this.controller.setRemoteBook(selected_asset.url, this.remoteLocationValue, selected_asset);
} else {
let url = utils.getDropdownValue(this.githubRepoDropdown);
let newUrl = new URL(url);
let newUrl = vscode.Uri.parse(url);
await this.controller.setRemoteBook(newUrl, this.remoteLocationValue);
}
return true;