Merge pull request #3658 from dpalou/MOBILE-4270

MOBILE-4303 iframe: Fix auto-login applied in H5P local URLs
main
Noel De Martin 2023-05-04 12:38:43 +02:00 committed by GitHub
commit 90603c022a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 10 deletions

View File

@ -156,8 +156,14 @@ export class CoreIframeComponent implements OnChanges, OnDestroy {
* Detect changes on input properties.
*/
async ngOnChanges(changes: {[name: string]: SimpleChange }): Promise<void> {
if (changes.src) {
let url = CoreUrlUtils.getYoutubeEmbedUrl(changes.src.currentValue) || changes.src.currentValue;
if (!changes.src) {
return;
}
let url = changes.src.currentValue;
if (!CoreUrlUtils.isLocalFileUrl(url)) {
url = CoreUrlUtils.getYoutubeEmbedUrl(changes.src.currentValue) || changes.src.currentValue;
this.displayHelp = CoreIframeUtils.shouldDisplayHelpForUrl(url);
const currentSite = CoreSites.getCurrentSite();
@ -173,14 +179,14 @@ export class CoreIframeComponent implements OnChanges, OnDestroy {
}
await CoreIframeUtils.fixIframeCookies(url);
this.safeUrl = DomSanitizer.bypassSecurityTrustResourceUrl(CoreFile.convertFileSrc(url));
// Now that the URL has been set, initialize the iframe. Wait for the iframe to the added to the DOM.
setTimeout(() => {
this.init();
});
}
this.safeUrl = DomSanitizer.bypassSecurityTrustResourceUrl(CoreFile.convertFileSrc(url));
// Now that the URL has been set, initialize the iframe. Wait for the iframe to the added to the DOM.
setTimeout(() => {
this.init();
});
}
/**

View File

@ -504,7 +504,7 @@ export class CoreUrlUtilsProvider {
*/
removeProtocolAndWWW(url: string): string {
// Remove protocol.
url = url.replace(/.*?:\/\//g, '');
url = url.replace(/^.*?:\/\//, '');
// Remove www.
url = url.replace(/^www./, '');