mirror of
https://github.com/kovetskiy/mark.git
synced 2026-03-17 07:57:37 +08:00
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>