checked for valid domain id

Signed-off-by: tracer <tracer@24unix.net>
This commit is contained in:
tracer 2022-02-13 15:47:23 +01:00
parent 6c2d5ab8a0
commit 6ba728ac07
1 changed files with 19 additions and 10 deletions

View File

@ -328,7 +328,9 @@ class RequestController
if (empty($this->uri[3])) { if (empty($this->uri[3])) {
$this->handleAllDomainsGetRequest(); $this->handleAllDomainsGetRequest();
} else { } else {
if ($result = $this->domainRepository->findById(id: $this->uri[3])) { $id = intval(value: $this->uri['3']);
if ($id > 0) {
if ($result = $this->domainRepository->findById(id: $id)) {
$domain = [ $domain = [
'id' => $result->getId(), 'id' => $result->getId(),
'name' => $result->getName(), 'name' => $result->getName(),
@ -340,6 +342,13 @@ class RequestController
$this->status = "404 Not Found "; $this->status = "404 Not Found ";
$this->message = "The specified domain was not found."; $this->message = "The specified domain was not found.";
} }
} else {
$this->header = "400 Bad request";
$this->status = "400 Not Found";
$this->message = "You need to supply an ID or user the /domain/name/<name> path.";
}
} }
} }
} }