Manuel Rüger 4c81c81fb3 fix: return original match on error in macro Apply()
Two bugs in the ReplaceAllFunc callback:
1. After yaml.Unmarshal failure, execution continued into Execute(),
   which could succeed and overwrite err with nil, silently swallowing
   the unmarshal error and producing output with default (empty) config.
2. After any error, the callback returned buffer.Bytes() (empty or
   partial) instead of the original match, corrupting the document.

Return the original match bytes unchanged on either error so the
directive is preserved in output and the error is not lost.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-16 19:18:29 +01:00
..