Fix whitespace handling in _has_meaningful_content function

• Preserve newlines and spaces as content
• Remove .strip() call on strings
• Treat all non-empty strings as meaningful
• Update logic comment for clarity
• Fix edge case with whitespace-only text
This commit is contained in:
yangdx 2025-10-03 13:46:51 +08:00
parent 94a89cd7de
commit 8b95cd3ed2

View file

@ -84,7 +84,9 @@ def _has_meaningful_content(value: Any) -> bool:
return False
if isinstance(value, str):
return len(value.strip()) > 0
# Don't strip whitespace - preserve all content including newlines, spaces, etc.
# Even pure whitespace characters like '\n' or ' ' are meaningful content
return len(value) > 0
if isinstance(value, (list, dict)):
return len(value) > 0