mirror of
https://github.com/nextcloud/server.git
synced 2026-06-11 01:30:50 -04:00
fix: Resolve some psalm issues
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
parent
bcfaa850f3
commit
d00b9cd2fe
3 changed files with 8 additions and 3 deletions
|
|
@ -69,9 +69,10 @@ class CorsPlugin extends ServerPlugin {
|
|||
return;
|
||||
}
|
||||
$originHeader = $request->getHeader('Origin');
|
||||
if ($this->ignoreOriginHeader($originHeader)) {
|
||||
if ($originHeader === null || $this->ignoreOriginHeader($originHeader)) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if (Util::isSameDomain($originHeader, $request->getAbsoluteUrl())) {
|
||||
return;
|
||||
|
|
@ -86,6 +87,10 @@ class CorsPlugin extends ServerPlugin {
|
|||
$this->server->on('beforeMethod:OPTIONS', [$this, 'setOptionsRequestHeaders'], 5);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Throwable $ex The thrown exception
|
||||
* @return void
|
||||
*/
|
||||
public function onException(\Throwable $ex) {
|
||||
$this->setCorsHeaders($this->server->httpRequest, $this->server->httpResponse);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -287,7 +287,7 @@ class Router implements IRouter {
|
|||
|
||||
// Reach here if it's valid
|
||||
$response = new \OC\OCS\Result(null, 100, 'OPTIONS request successful');
|
||||
$response = \OC_Response::setOptionsRequestHeaders($response);
|
||||
\OC_Response::setOptionsRequestHeaders($response, $this->config);
|
||||
\OC_API::respond($response, \OC_API::requestedFormat());
|
||||
|
||||
// Return since no more processing for an OPTIONS request is required
|
||||
|
|
|
|||
|
|
@ -650,7 +650,7 @@ class Util {
|
|||
$host = \strtolower($parts['host']);
|
||||
|
||||
$port = $parts['port'] ?? null;
|
||||
if ($port === null || $port === '') {
|
||||
if ($port === null || $port === 0) {
|
||||
if ($protocol === 'http') {
|
||||
$port = 80;
|
||||
} elseif ($protocol === 'https') {
|
||||
|
|
|
|||
Loading…
Reference in a new issue