From f4cd6f37b043644ba76d5ba898d1817fab283bb9 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Thu, 30 May 2019 13:35:28 +0200 Subject: [PATCH] MOBILE-3039 core: Fix old custom URL links in iOS --- src/providers/urlschemes.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/providers/urlschemes.ts b/src/providers/urlschemes.ts index 6617e627e..83b189c3a 100644 --- a/src/providers/urlschemes.ts +++ b/src/providers/urlschemes.ts @@ -125,10 +125,6 @@ export class CoreCustomURLSchemesProvider { // Some sites add a # at the end of the URL. If it's there, remove it. url = url.replace(/\/?#?\/?$/, ''); - // In iOS, the protocol after the scheme doesn't have ":". Add it. - // E.g. "moodlemobile://https://..." is received as "moodlemobile://https//..." - url = url.replace(/\/\/(https?)\/\//, '//$1://'); - modal = this.domUtils.showModalLoading(); // Get the data from the URL. @@ -137,8 +133,14 @@ export class CoreCustomURLSchemesProvider { return this.getCustomURLTokenData(url); } else if (this.isCustomURLLink(url)) { + // In iOS, the protocol after the scheme doesn't have ":". Add it. + url = url.replace(/\/\/link=(https?)\/\//, '//link=$1://'); + return this.getCustomURLLinkData(url); } else { + // In iOS, the protocol after the scheme doesn't have ":". Add it. + url = url.replace(/\/\/(https?)\/\//, '//$1://'); + return this.getCustomURLData(url); } }).then((result) => {