From bc8b10a69e0478872a289375d9b9b11bcc5f7bd1 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Fri, 4 Jul 2025 16:46:14 +0530 Subject: [PATCH] fix: origin tests --- src/Appwrite/Network/Validator/Origin.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Appwrite/Network/Validator/Origin.php b/src/Appwrite/Network/Validator/Origin.php index 6cd212af2f..c8d9ee626d 100644 --- a/src/Appwrite/Network/Validator/Origin.php +++ b/src/Appwrite/Network/Validator/Origin.php @@ -42,12 +42,12 @@ class Origin extends Validator $this->scheme = $this->parseScheme($origin); $this->host = strtolower(parse_url($origin, PHP_URL_HOST) ?? ''); - $validator = new Hostname($this->hostnames); - if (in_array($this->scheme, [Platform::SCHEME_HTTP, Platform::SCHEME_HTTPS]) && $validator->isValid($this->host)) { // Valid HTTP/HTTPS origin - return true; + if (in_array($this->scheme, [Platform::SCHEME_HTTP, Platform::SCHEME_HTTPS], true)) { + $validator = new Hostname($this->hostnames); + return $validator->isValid($this->host); } - if (!empty($this->scheme) && in_array($this->scheme, $this->schemes, true)) { // Valid scheme-based origin + if (!empty($this->scheme) && in_array($this->scheme, $this->schemes, true)) { return true; }