Skip to content

Commit

Permalink
Issue CollaboraOnline#43: Explicitly return NULL, to avoid inconsiste…
Browse files Browse the repository at this point in the history
…nt return points.
  • Loading branch information
donquixote committed Nov 8, 2024
1 parent 6712aff commit 8f660e9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Cool/CoolRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,36 +140,36 @@ public function getWopiClientURL() {
$wopi_client_server = $default_config->get('cool')['server'];
if (!$wopi_client_server) {
$this->error_code = 201;
return;
return NULL;
}
$wopi_client_server = trim($wopi_client_server);

if (!strStartsWith($wopi_client_server, 'http')) {
$this->error_code = 204;
return;
return NULL;
}

if (!strStartsWith($wopi_client_server, $_HOST_SCHEME . '://')) {
$this->error_code = 202;
return;
return NULL;
}

$discovery = getDiscovery($wopi_client_server);
if ($discovery === false) {
$this->error_code = 203;
return;
return NULL;
}

$discovery_parsed = simplexml_load_string($discovery);
if (!$discovery_parsed) {
$this->error_code = 102;
return;
return NULL;
}

$this->wopi_src = strval(getWopiSrcUrl($discovery_parsed, 'text/plain')[0]);
if (!$this->wopi_src) {
$this->error_code = 103;
return;
return NULL;
}

return $this->wopi_src;
Expand Down

0 comments on commit 8f660e9

Please sign in to comment.