Skip to content

Commit 342ff13

Browse files
committed
Fix config overwrite when resync triggered without form submission
1 parent 2439391 commit 342ff13

File tree

1 file changed

+4
-2
lines changed
  • pfSense-pkg-NetBird/files/usr/local/pkg/netbird

1 file changed

+4
-2
lines changed

pfSense-pkg-NetBird/files/usr/local/pkg/netbird/netbird.inc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,10 @@ function netbird_resync_config()
5555
];
5656

5757
foreach ($config_map as $post_key => [$json_key, $enabled_val]) {
58-
$checked = ($_POST[$post_key] ?? '') === 'on';
59-
$config[$json_key] = ($checked === $enabled_val);
58+
if (array_key_exists($post_key, $_POST)) {
59+
$checked = $_POST[$post_key] === 'on';
60+
$config[$json_key] = ($checked === $enabled_val);
61+
}
6062
}
6163

6264
file_put_contents(NETBIRD_CONFIG, json_encode($config, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));

0 commit comments

Comments
 (0)