mirror of
https://github.com/appwrite/appwrite
synced 2026-05-24 01:18:37 +00:00
chore: update scheme check
This commit is contained in:
parent
1555abcbd6
commit
fffdab23f9
1 changed files with 8 additions and 6 deletions
|
|
@ -40,14 +40,16 @@ class Origin extends Validator
|
|||
}
|
||||
|
||||
$this->scheme = $this->parseScheme($origin);
|
||||
$this->host = strtolower(parse_url($origin, PHP_URL_HOST));
|
||||
|
||||
if (!empty($this->scheme) && !in_array($this->scheme, $this->schemes, true)) {
|
||||
return false;
|
||||
}
|
||||
$this->host = strtolower(parse_url($origin, PHP_URL_HOST) ?? '');
|
||||
|
||||
$validator = new Hostname($this->hostnames);
|
||||
return $validator->isValid($this->host);
|
||||
if (in_array($this->scheme, ['http', 'https']) && $validator->isValid($this->host)) { // Valid HTTP/HTTPS origin
|
||||
return true;
|
||||
} if (!empty($this->scheme) && in_array($this->scheme, $this->schemes, true)) { // Valid scheme-based origin
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue