diff --git a/Plugin/unraid/include/config.php b/Plugin/unraid/include/config.php index 1db397c..9dbac87 100644 --- a/Plugin/unraid/include/config.php +++ b/Plugin/unraid/include/config.php @@ -276,6 +276,14 @@ function vv_read_conf_raw(string $filename): string { function vv_write_conf_raw(string $filename, string $content): bool { $path = CONF_DIR . '/' . $filename; $tmp = $path . '.vv.tmp'; + + // Guarantee the trailing newline. A textarea does not supply one, so saving through the raw + // editor left master.conf ending mid-line — and appending is a real pattern here + // (conf_upgrade, and the array writers below), so the next `>>` would have joined itself + // onto the last setting instead of starting a line. Appended, never stripped: a deliberate + // run of blank lines at the end of a conf is the author's business. + if ($content !== '' && !str_ends_with($content, "\n")) $content .= "\n"; + if (file_put_contents($tmp, $content) === false) return false; return rename($tmp, $path); }