MOBILE-3013 core: Support relative URLs in redirect

main
Dani Palou 2019-05-14 10:54:30 +02:00
parent 15aac08bdd
commit 47ac489b24
1 changed files with 6 additions and 1 deletions

View File

@ -130,7 +130,7 @@ export class CoreCustomURLSchemesProvider {
}).then((result) => {
data = result;
if (data.redirect && data.redirect.indexOf(data.siteUrl) == -1) {
if (data.redirect && data.redirect.match(/^https?:\/\//) && data.redirect.indexOf(data.siteUrl) == -1) {
// Redirect URL must belong to the same site. Reject.
return Promise.reject(this.translate.instant('core.contentlinks.errorredirectothersite'));
}
@ -173,6 +173,11 @@ export class CoreCustomURLSchemesProvider {
return;
}
if (data.redirect && !data.redirect.match(/^https?:\/\//)) {
// Redirect is a relative URL. Append the site URL.
data.redirect = this.textUtils.concatenatePaths(data.siteUrl, data.redirect);
}
let promise;
if (siteId) {