Skip to content

Commit ee8407b

Browse files
matteiusclaude
andcommitted
Preserve user indentation in go2rtc source override YAML
Stop stripping leading whitespace from override lines so that nested YAML (e.g. list items with indented subkeys) is preserved correctly. Base indentation (4 spaces) is still prepended to every line. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 64e6103 commit ee8407b

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

src/video/go2rtc/go2rtc_process.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -716,18 +716,13 @@ bool go2rtc_process_generate_config(const char *config_path, int api_port) {
716716
// Quote stream name for YAML safety (handles spaces, colons, etc.)
717717
fprintf(config_file, " \"%s\":\n", streams[i].name);
718718

719-
// Write each line of the override with proper indentation
719+
// Write each line of the override with base indentation while
720+
// preserving any user-provided indentation within the YAML.
720721
const char *p = streams[i].go2rtc_source_override;
721722
while (*p) {
722-
// Skip leading whitespace on each line
723-
while (*p == ' ' || *p == '\t') p++;
724-
if (*p == '\0') break;
725-
726723
const char *eol = strchr(p, '\n');
727724
if (eol) {
728-
if (eol > p) { // skip empty lines
729-
fprintf(config_file, " %.*s\n", (int)(eol - p), p);
730-
}
725+
fprintf(config_file, " %.*s\n", (int)(eol - p), p);
731726
p = eol + 1;
732727
} else {
733728
fprintf(config_file, " %s\n", p);

0 commit comments

Comments
 (0)