From f8ec79495329f21534403fd48505bec6185a7046 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 24 May 2026 12:27:24 +0300 Subject: fix(wireguard): handle leading whitespace in /etc/hosts lines In prune_host_line, body.split(/\s+/) on a line with leading whitespace produced tokens starting with an empty string, which was then shifted into as ''. This caused the rewritten /etc/hosts entry to lose its IP silently. Fix by stripping the body before splitting: body.strip.split(/\s+/). Refs: hc --- lib/hyperstack/wireguard.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/hyperstack') diff --git a/lib/hyperstack/wireguard.rb b/lib/hyperstack/wireguard.rb index 4e909ba..46bd682 100644 --- a/lib/hyperstack/wireguard.rb +++ b/lib/hyperstack/wireguard.rb @@ -209,7 +209,7 @@ module HyperstackVM return [line, []] if stripped.empty? || stripped.start_with?('#') body, comment = line.split('#', 2) - tokens = body.split(/\s+/) + tokens = body.strip.split(/\s+/) return [line, []] if tokens.empty? ip = tokens.shift -- cgit v1.2.3