Skip to content

[BUG] kebab_filenames setting doesn't convert periods to hyphens in filenames #423

@divideby0

Description

@divideby0

Bug Description

When BASIC_MEMORY_KEBAB_FILENAMES=true, periods in note titles are not converted to hyphens in filenames, though permalinks work correctly.

Example

Title: "Test 3.0 Version"

Expected:

  • File path: test/test-3-0-version.md
  • Permalink: test/test-3-0-version

Actual:

  • File path: test/Test 3.0 Version.md
  • Permalink: test/test-3-0-version ✓ (works correctly)

Root Cause

The Entity.safe_title property uses generate_permalink() which internally calls os.path.splitext(). When processing a bare title like "Test 3.0 Version":

os.path.splitext("Test 3.0 Version")
# Returns: ("Test 3", ".0 Version")

The period is treated as a file extension separator, so only "Test 3" gets kebab-cased, and ".0 Version" is appended back unchanged.

Environment

Proposed Solution

Replace periods with hyphens before calling generate_permalink():

# In src/basic_memory/schemas/base.py
if use_kebab_case:
    fixed_title = fixed_title.replace('.', '-')  # Prevent splitext confusion
    fixed_title = generate_permalink(file_path=fixed_title, split_extension=True)

Also need to convert file_path from @property to @computed_field so it's included in Pydantic's model_dump().

Impact

Affects users with BASIC_MEMORY_KEBAB_FILENAMES=true who have version numbers or other periods in their note titles.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions