* fix #207698

* fix compilation
This commit is contained in:
Sandeep Somavarapu
2024-03-20 02:02:07 +01:00
committed by GitHub
parent 9f278ba6e1
commit a337b4ef65
2 changed files with 39 additions and 1 deletions
@@ -288,7 +288,7 @@ export class ExtensionManagementService extends AbstractExtensionManagementServi
const key = ExtensionKey.create(extension).toString();
let installExtensionTask = this.installGalleryExtensionsTasks.get(key);
if (!installExtensionTask) {
this.installGalleryExtensionsTasks.set(key, installExtensionTask = new InstallGalleryExtensionTask(manifest, extension, options, this.extensionsDownloader, this.extensionsScanner, this.uriIdentityService, this.userDataProfilesService, this.extensionsScannerService, this.extensionsProfileScannerService, this.logService));
this.installGalleryExtensionsTasks.set(key, installExtensionTask = new InstallGalleryExtensionTask(manifest, extension, options, this.extensionsDownloader, this.extensionsScanner, this.uriIdentityService, this.userDataProfilesService, this.extensionsScannerService, this.extensionsProfileScannerService, this.logService, this.telemetryService));
installExtensionTask.waitUntilTaskIsFinished().finally(() => this.installGalleryExtensionsTasks.delete(key));
}
return installExtensionTask;
@@ -875,6 +875,7 @@ export class InstallGalleryExtensionTask extends InstallExtensionTask {
extensionsScannerService: IExtensionsScannerService,
extensionsProfileScannerService: IExtensionsProfileScannerService,
logService: ILogService,
private readonly telemetryService: ITelemetryService,
) {
super(gallery.identifier, gallery, options, extensionsScanner, uriIdentityService, userDataProfilesService, extensionsScannerService, extensionsProfileScannerService, logService);
}
@@ -921,6 +922,42 @@ export class InstallGalleryExtensionTask extends InstallExtensionTask {
}
}
try {
return await this.downloadAndInstallExtension(metadata, token);
} catch (error) {
if (error instanceof ExtensionManagementError && (error.code === ExtensionManagementErrorCode.CorruptZip || error.code === ExtensionManagementErrorCode.IncompleteZip)) {
this.logService.info(`Downloaded VSIX is invalid. Trying to download and install again...`, this.gallery.identifier.id);
type RetryInstallingInvalidVSIXClassification = {
owner: 'sandy081';
comment: 'Event reporting the retry of installing an invalid VSIX';
extensionId: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Extension Id' };
succeeded?: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Success value' };
};
type RetryInstallingInvalidVSIXEvent = {
extensionId: string;
succeeded: boolean;
};
try {
const result = await this.downloadAndInstallExtension(metadata, token);
this.telemetryService.publicLog2<RetryInstallingInvalidVSIXEvent, RetryInstallingInvalidVSIXClassification>('extensiongallery:install:retry', {
extensionId: this.gallery.identifier.id,
succeeded: true
});
return result;
} catch (error) {
this.telemetryService.publicLog2<RetryInstallingInvalidVSIXEvent, RetryInstallingInvalidVSIXClassification>('extensiongallery:install:retry', {
extensionId: this.gallery.identifier.id,
succeeded: false
});
throw error;
}
} else {
throw error;
}
}
}
private async downloadAndInstallExtension(metadata: Metadata, token: CancellationToken): Promise<[ILocalExtension, Metadata]> {
const { location, verificationStatus } = await this.extensionsDownloader.download(this.gallery, this._operation, !this.options.donotVerifySignature);
try {
this._verificationStatus = verificationStatus;
@@ -110,6 +110,7 @@ class TestInstallGalleryExtensionTask extends InstallGalleryExtensionTask {
extensionsScannerService,
extensionsProfileScannerService,
logService,
NullTelemetryService
);
}