[BUGFIX] Do not double-prepend the URL scheme on preview URLs 77/58177/2
authorBenni Mack <benni@typo3.org>
Tue, 4 Sep 2018 09:19:15 +0000 (11:19 +0200)
committerGeorg Ringer <georg.ringer@gmail.com>
Tue, 4 Sep 2018 09:36:35 +0000 (11:36 +0200)
When having a pseudo-site the view functionality is broken
due to some different handling how to deal with protocols.

Resolves: #86134
Releases: master
Change-Id: Ia3b08ce968ecfdce631ce9c7ff9c973cfb25eef5
Reviewed-on: https://review.typo3.org/58177
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
typo3/sysext/backend/Classes/Utility/BackendUtility.php

index c5d830b..0733c71 100644 (file)
@@ -2853,12 +2853,15 @@ class BackendUtility
                 $result = $siteMatcher->matchRequest(new ServerRequest($domain));
                 $site = $result->getSite();
                 if ($site instanceof PseudoSite) {
-                    $domain = $site->getBase();
+                    $domain = (string)$site->getBase();
                     $domain = ltrim($domain, '/');
                 }
             }
             if ($domain) {
-                $domain = $protocol . '://' . $domain;
+                // prepend the current protocol, if none is given
+                if (!parse_url($domain, PHP_URL_SCHEME)) {
+                    $domain = $protocol . '://' . $domain;
+                }
             } else {
                 $domain = rtrim(GeneralUtility::getIndpEnv('TYPO3_SITE_URL'), '/');
             }