From 8819af270d62fb86dfbf9a91d64c7fb064a413c5 Mon Sep 17 00:00:00 2001 From: Aarnav Tale Date: Sat, 21 Jun 2025 13:07:39 -0400 Subject: [PATCH] fix: properly handle removing the last split dns record Previously it would set the value to an empty array, breaking DNS resolution for that split completely. The correct behavior was to remove the key altogether! This fixes #231 --- CHANGELOG.md | 3 ++- app/routes/dns/dns-actions.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4443af4..dd7be6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,8 +5,9 @@ - Begin using a new SQLite database file in `/var/lib/headplane/hp_persist.db`. - The database is created automatically if it does not exist. - It currently stores SSH connection details and will migrate older data. -- The docker container now runs in a non-root, distroless image (closes [#255](https://github.com/tale/headplane/issues/255)) +- The docker container now runs in a non-root, distroless image (closes [#255](https://github.com/tale/headplane/issues/255)). - You may need to run `chown -R 65532:65532 ` on your data directory to ensure the container can write to it. +- Removing a Split DNS record will no longer make the split domain unresolvable by clients (closes [#231](https://github.com/tale/headplane/issues/231)). ### 0.6.0 (May 25, 2025) - Headplane 0.6.0 now requires **Headscale 0.26.0** or newer. diff --git a/app/routes/dns/dns-actions.ts b/app/routes/dns/dns-actions.ts index 654b8ff..d318737 100644 --- a/app/routes/dns/dns-actions.ts +++ b/app/routes/dns/dns-actions.ts @@ -104,7 +104,7 @@ async function removeNs(formData: FormData, context: LoadContext) { await context.hs.patch([ { path: `dns.nameservers.split."${splitName}"`, - value: servers, + value: servers.length > 0 ? servers : null, }, ]); }