Sfoglia il codice sorgente

fixed empty host

develop
Robin Thoni 9 anni fa
parent
commit
e7c82b333b
1 ha cambiato i file con 2 aggiunte e 1 eliminazioni
  1. 2
    1
      src/DBO/Actions/ActionAddHost.cpp

+ 2
- 1
src/DBO/Actions/ActionAddHost.cpp Vedi File

@@ -27,8 +27,9 @@ ActionAddHost::ActionAddHost()
27 27
 
28 28
 const std::string ActionAddHost::getSql() const
29 29
 {
30
+    auto host = _host.empty() ? _domain : _host + "." + _domain;
30 31
     auto query = "INSERT INTO records (domain_id, name, type, content, ttl, prio, change_date)\n"
31
-            "    VALUES(@domain_id, \"" + _host + "." + _domain + "\", \"" + _recordType + "\","
32
+            "    VALUES(@domain_id, \"" + host + "\", \"" + _recordType + "\","
32 33
             " \"" + _recordValue + "\", 84600, 0, " + std::to_string(time(nullptr)) + ");\n";
33 34
 
34 35
     if (_reverseEnabled && _recordType == "A")

Loading…
Annulla
Salva