diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-24 12:27:24 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-24 12:27:24 +0300 |
| commit | f8ec79495329f21534403fd48505bec6185a7046 (patch) | |
| tree | c673a2c10d04a4cf8180bb069b6d58df63d21dba /lib/hyperstack | |
| parent | cbc74944490a18c2cccbc8a108b3665b2cf3650b (diff) | |
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
Diffstat (limited to 'lib/hyperstack')
| -rw-r--r-- | lib/hyperstack/wireguard.rb | 2 |
1 files changed, 1 insertions, 1 deletions
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 |
