Fix: Bad characters when using the !include function @Cerebrovinny (#1249)
### what- Fixed issue with YAML processing where strings starting with
#
character were being interpreted as comments and returning null values - Added special handling for strings starting with
#
by setting them to use single-quoted style in YAML nodes - Implemented this fix in multiple places: filetype package, YAML utils, and YQ utils
why
- Strings starting with # were being incorrectly processed as comments in YAML, causing
!include
function to return null values - This was causing unexpected behavior when users tried to include values that started with
#
character - Ensure that all strings starting with # are properly preserved throughout YAML processing
references
- Closes #1205
Summary by CodeRabbit
-
Bug Fixes
- Improved handling of YAML strings starting with
#
to ensure they are correctly preserved and not misinterpreted as comments, including when using custom tags,!include
directives, or YQ expressions.
- Improved handling of YAML strings starting with
-
Tests
- Added comprehensive tests covering YAML parsing, node processing, and inclusion scenarios to verify correct handling of strings beginning with
#
. - Introduced tests for utility functions related to YAML processing, ensuring robust error handling and correct style application.
- Added comprehensive tests covering YAML parsing, node processing, and inclusion scenarios to verify correct handling of strings beginning with