From b34d64b4d438567d770b476a95e6f919db84ae3c Mon Sep 17 00:00:00 2001 From: loks0n <22452787+loks0n@users.noreply.github.com> Date: Fri, 24 Jan 2025 17:58:46 +0000 Subject: [PATCH] fix: tests --- app/init.php | 2 +- src/Appwrite/Network/Validator/Redirect.php | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/init.php b/app/init.php index 9c7166c1e6..2d1aae9de8 100644 --- a/app/init.php +++ b/app/init.php @@ -1232,7 +1232,7 @@ App::setResource('schemes', function (array $platforms) { Origin::CLIENT_TYPE_FLUTTER_REACT_NATIVE_IOS, Origin::CLIENT_TYPE_FLUTTER_REACT_NATIVE_ANDROID ])) { - schemes[] = $platform['scheme']; + $schemes[] = $platform['scheme']; } } diff --git a/src/Appwrite/Network/Validator/Redirect.php b/src/Appwrite/Network/Validator/Redirect.php index 1b019d4201..05482f1072 100644 --- a/src/Appwrite/Network/Validator/Redirect.php +++ b/src/Appwrite/Network/Validator/Redirect.php @@ -48,9 +48,10 @@ class Redirect extends Host { // `parse_url` returns false for URL with only a scheme // We need to handle parsing the scheme manually - if (preg_match('/^([a-z][a-z0-9+\.-]*):\/+$/i', $value, $matches)) { - $scheme = strtolower($matches[1]); + if (!preg_match('/^([a-z][a-z0-9+\.-]*):\/+$/i', $value, $matches)) { + return false; } + $scheme = strtolower($matches[1]); // If the scheme is not http or https, check the hostname if (\in_array($scheme, ["http", "https"])) {