Merge pull request #4003 from alfonso-salces/MOBILE-4470

MOBILE-4470 external-content: Fix url replacement in inline styles
main
Dani Palou 2024-04-09 14:42:06 +02:00 committed by GitHub
commit 7142177e47
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

View File

@ -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 {