Skip to content

Commit 2b7d027

Browse files
committed
Small fixes
1 parent 014ab7c commit 2b7d027

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

start_bind9_api.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,12 +365,16 @@ function handleAddRecord($zoneName, $request, $pdo) {
365365
} catch (JsonException $e) {
366366
return [400, ['error' => 'Invalid JSON: ' . $e->getMessage()]];
367367
}
368-
$name = $body['name'] ?? '';
368+
$name = isset($body['name']) ? trim($body['name']) : '@';
369369
$type = strtoupper($body['type'] ?? '');
370370
$ttl = $body['ttl'] ?? 3600;
371371
$rdata = $body['rdata'] ?? '';
372372

373-
if (!$name || !$type || !$rdata) {
373+
if ($name === '') {
374+
$name = '@';
375+
}
376+
377+
if (!$type || !$rdata) {
374378
return [400, ['error' => 'Missing required fields']];
375379
}
376380

0 commit comments

Comments
 (0)