namecheap: pass the TLD correctly

this is safe because namecheap does not allow external domains to be hosted.
otherwise, we would have to use tldjs
This commit is contained in:
Girish Ramakrishnan
2024-01-08 11:54:37 +01:00
parent 053f81a53e
commit 6cdb448f62

View File

@@ -57,8 +57,8 @@ async function getZone(domainConfig, zoneName) {
const query = await getQuery(domainConfig);
query.Command = 'namecheap.domains.dns.getHosts';
query.SLD = zoneName.split('.')[0];
query.TLD = zoneName.split('.')[1];
query.SLD = zoneName.split('.', 1)[0];
query.TLD = zoneName.slice(query.SLD.length + 1);
const [error, response] = await safe(superagent.get(ENDPOINT).query(query).ok(() => true));
if (error) throw new BoxError(BoxError.NETWORK_ERROR, error.message);