diff --git a/src/core/directives/external-content.ts b/src/core/directives/external-content.ts index 35a1bbf8f..0ede98c26 100644 --- a/src/core/directives/external-content.ts +++ b/src/core/directives/external-content.ts @@ -39,6 +39,7 @@ import { AsyncDirective } from '@classes/async-directive'; import { CoreDirectivesRegistry } from '@singletons/directives-registry'; import { CorePromisedValue } from '@classes/promised-value'; import { CorePlatform } from '@services/platform'; +import { CoreTextUtils } from '@services/utils/text'; /** * Directive to handle external content. @@ -287,7 +288,7 @@ export class CoreExternalContentDirective implements AfterViewInit, OnChanges, O const finalUrl = await CoreFilepool.getSrcByUrl(siteId, url, this.component, this.componentId, 0, true, true); this.logger.debug('Using URL ' + finalUrl + ' for ' + url + ' in inline styles'); - inlineStyles = inlineStyles.replace(new RegExp(url, 'gi'), finalUrl); + inlineStyles = inlineStyles.replace(new RegExp(CoreTextUtils.escapeForRegex(url), 'gi'), finalUrl); }); try {