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,17 +328,26 @@ class RequestController
if (empty($this->uri[3])) {
$this->handleAllDomainsGetRequest();
} else {
if ($result = $this->domainRepository->findById(id: $this->uri[3])) {
$domain = [
'id' => $result->getId(),
'name' => $result->getName(),
'content' => json_decode(json: $result->getContent())
];
$this->result = $domain;
$id = intval(value: $this->uri['3']);
if ($id > 0) {
if ($result = $this->domainRepository->findById(id: $id)) {
$domain = [
'id' => $result->getId(),
'name' => $result->getName(),
'content' => json_decode(json: $result->getContent())
];
$this->result = $domain;
} else {
$this->header = "404 Not Found ";
$this->status = "404 Not Found ";
$this->message = "The specified domain was not found.";
}
} else {
$this->header = "404 Not Found ";
$this->status = "404 Not Found ";
$this->message = "The specified domain was not found.";
$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.";
}
}
}