MOBILE-3068 page: Fix base64 images shown
parent
0c578d8e5d
commit
789eb299b0
|
@ -49,6 +49,8 @@ export class CoreExternalContentDirective implements AfterViewInit, OnChanges {
|
|||
protected logger;
|
||||
protected initialized = false;
|
||||
|
||||
invalid = false;
|
||||
|
||||
constructor(element: ElementRef, logger: CoreLoggerProvider, private filepoolProvider: CoreFilepoolProvider,
|
||||
private platform: Platform, private sitesProvider: CoreSitesProvider, private domUtils: CoreDomUtilsProvider,
|
||||
private urlUtils: CoreUrlUtilsProvider, private appProvider: CoreAppProvider, private utils: CoreUtilsProvider) {
|
||||
|
@ -141,6 +143,15 @@ export class CoreExternalContentDirective implements AfterViewInit, OnChanges {
|
|||
}
|
||||
|
||||
} else {
|
||||
this.invalid = true;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Avoid handling data url's.
|
||||
if (url.indexOf('data:') === 0) {
|
||||
this.invalid = true;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -409,7 +409,12 @@ export class CoreFormatTextDirective implements OnChanges {
|
|||
// Walk through the content to find images, and add our directive.
|
||||
images.forEach((img: HTMLElement) => {
|
||||
this.addMediaAdaptClass(img);
|
||||
externalImages.push(this.addExternalContent(img));
|
||||
|
||||
const externalImage = this.addExternalContent(img);
|
||||
if (!externalImage.invalid) {
|
||||
externalImages.push(externalImage);
|
||||
}
|
||||
|
||||
if (this.utils.isTrueOrOne(this.adaptImg) && !img.classList.contains('icon')) {
|
||||
this.adaptImage(img);
|
||||
}
|
||||
|
@ -475,7 +480,9 @@ export class CoreFormatTextDirective implements OnChanges {
|
|||
promise = Promise.resolve();
|
||||
}
|
||||
|
||||
return promise.then(() => {
|
||||
return promise.catch(() => {
|
||||
// Ignore errors. So content gets always shown.
|
||||
}).then(() => {
|
||||
return div;
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue