diff --git a/src/core/directives/external-content.ts b/src/core/directives/external-content.ts index 6bbf6d9f4..17635acd3 100644 --- a/src/core/directives/external-content.ts +++ b/src/core/directives/external-content.ts @@ -25,7 +25,7 @@ import { } from '@angular/core'; import { CoreApp } from '@services/app'; import { CoreFile } from '@services/file'; -import { CoreFilepool } from '@services/filepool'; +import { CoreFilepool, CoreFilepoolFileActions, CoreFilepoolFileEventData } from '@services/filepool'; import { CoreSites } from '@services/sites'; import { CoreDomUtils } from '@services/utils/dom'; import { CoreUrlUtils } from '@services/utils/url'; @@ -395,7 +395,12 @@ export class CoreExternalContentDirective implements AfterViewInit, OnChanges, O // Listen for download changes in the file. const eventName = await CoreFilepool.getFileEventNameByUrl(site.getId(), url); - this.fileEventObserver = CoreEvents.on(eventName, async () => { + this.fileEventObserver = CoreEvents.on(eventName, async (data: CoreFilepoolFileEventData) => { + if (data.action === CoreFilepoolFileActions.DOWNLOAD && !data.success) { + // Error downloading the file. Don't try again. + return; + } + const newState = await CoreFilepool.getFileStateByUrl(site.getId(), url); if (newState === state) { return; diff --git a/src/core/services/filepool.ts b/src/core/services/filepool.ts index 99d5ea855..40c2368a6 100644 --- a/src/core/services/filepool.ts +++ b/src/core/services/filepool.ts @@ -1251,7 +1251,7 @@ export class CoreFilepoolProvider { } /** - * Get the name of the event used to notify download events (CoreEventsProvider). + * Get the name of the event used to notify download events. * * @param siteId The site ID. * @param fileId The file ID. @@ -1262,7 +1262,7 @@ export class CoreFilepoolProvider { } /** - * Get the name of the event used to notify download events (CoreEventsProvider). + * Get the name of the event used to notify download events. * * @param siteId The site ID. * @param fileUrl The absolute URL to the file. @@ -3008,7 +3008,7 @@ export class CoreFilepoolProvider { } /** - * Trigger mmCoreEventPackageStatusChanged with the right data. + * Trigger package status changed event with the right data. * * @param siteId Site ID. * @param status New package status.