diff --git a/core/src/node/api/processors/download.ts b/core/src/node/api/processors/download.ts index 98464dd52d..d26e46d590 100644 --- a/core/src/node/api/processors/download.ts +++ b/core/src/node/api/processors/download.ts @@ -66,6 +66,7 @@ export class Downloader implements Processor { localPath: normalizedPath, } DownloadManager.instance.downloadProgressMap[modelId] = initialDownloadState + DownloadManager.instance.downloadInfo[normalizedPath] = initialDownloadState if (downloadRequest.downloadType === 'extension') { observer?.(DownloadEvent.onFileDownloadUpdate, initialDownloadState) @@ -118,12 +119,14 @@ export class Downloader implements Processor { if (rq) { DownloadManager.instance.networkRequests[fileName] = undefined rq?.abort() - } else { - observer?.(DownloadEvent.onFileDownloadError, { - fileName, - error: 'aborted', - }) } + + const downloadInfo = DownloadManager.instance.downloadInfo[fileName] + observer?.(DownloadEvent.onFileDownloadError, { + ...downloadInfo, + fileName, + error: 'aborted', + }) } resumeDownload(observer: any, fileName: any) { diff --git a/core/src/node/helper/download.ts b/core/src/node/helper/download.ts index b9fb88bb5c..b7560d100d 100644 --- a/core/src/node/helper/download.ts +++ b/core/src/node/helper/download.ts @@ -8,8 +8,12 @@ export class DownloadManager { public static instance: DownloadManager = new DownloadManager() + // store the download information with key is model id public downloadProgressMap: Record = {} + // store the download infomation with key is normalized file path + public downloadInfo: Record = {} + constructor() { if (DownloadManager.instance) { return DownloadManager.instance