From 60028250a214d6b9d8e9c2f6563fe23689838435 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Sun, 19 Feb 2023 13:01:50 +0100 Subject: [PATCH] Fix url parsing --- app/controllers/general.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index ad4d558d54..2a0b73df48 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -67,8 +67,10 @@ App::init() // Function Preview if(\str_ends_with($host, App::getEnv('_APP_DOMAIN_FUNCTIONS'))) { - $host = rtrim($host, App::getEnv('_APP_DOMAIN_FUNCTIONS')); - $host = rtrim($host, '.'); + // Remove domain from host + $previewDomain = App::getEnv('_APP_DOMAIN_FUNCTIONS'); + $host = \substr($host, 0, -1 * (1 + \strlen($previewDomain))); // +1 for starting dot (.) + $subdomains = explode('.', $host); if(\count($subdomains) === 2) {