mirror of
https://github.com/basicmachines-co/basic-memory
synced 2026-06-21 13:47:35 +00:00
fix: handle UTF-8 BOM in frontmatter parsing
Fixes #452 - Imported conversations not fully indexed Files with UTF-8 BOM (Byte Order Mark) at the start would fail frontmatter detection, causing: - Title to fall back to filename instead of frontmatter value - Permalink to be null in the database Added strip_bom() helper function and updated all frontmatter-related functions to strip BOM before processing: - has_frontmatter() - parse_frontmatter() - remove_frontmatter() - EntityParser.parse_markdown_content() Added comprehensive tests for BOM handling with various scenarios. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: phernandez <paul@basicmachines.co>
This commit is contained in:
@@ -227,6 +227,11 @@ class EntityParser:
|
||||
Returns:
|
||||
EntityMarkdown with parsed content
|
||||
"""
|
||||
# Strip BOM before parsing (can be present in files from Windows or certain sources)
|
||||
# See issue #452
|
||||
from basic_memory.file_utils import strip_bom
|
||||
content = strip_bom(content)
|
||||
|
||||
# Parse frontmatter with proper error handling for malformed YAML
|
||||
try:
|
||||
post = frontmatter.loads(content)
|
||||
|
||||
Reference in New Issue
Block a user