Summary
Project lookups in the dependency injection functions get_project_config() and get_project_id() were failing when project names contained characters that needed permalink normalization (e.g., spaces, special characters).
Problem
The get_project_config() and get_project_id() functions in src/basic_memory/deps.py were directly passing project names to project_repository.get_by_permalink() without first converting them to permalinks using generate_permalink().
This caused lookups to fail for projects with names containing:
- Spaces
- Special characters
- Capital letters that should be normalized
Root Cause
Location: src/basic_memory/deps.py:61-68 and src/basic_memory/deps.py:147-154
The code was doing:
project_obj = await project_repository.get_by_permalink(str(project))
Instead of:
project_permalink = generate_permalink(str(project))
project_obj = await project_repository.get_by_permalink(project_permalink)
Solution
Added permalink normalization before database lookups in both functions:
- Import
generate_permalink from basic_memory.utils
- Convert project name to permalink before lookup
- Use normalized permalink for database query
Impact
This bug would have caused:
- 404 errors when accessing projects via API with non-normalized names
- Inconsistent behavior between different project name formats
- Failed project resolution in dependency injection chain
Related
Similar to the fix in #345 for project deletion with permalink normalization.
Summary
Project lookups in the dependency injection functions
get_project_config()andget_project_id()were failing when project names contained characters that needed permalink normalization (e.g., spaces, special characters).Problem
The
get_project_config()andget_project_id()functions insrc/basic_memory/deps.pywere directly passing project names toproject_repository.get_by_permalink()without first converting them to permalinks usinggenerate_permalink().This caused lookups to fail for projects with names containing:
Root Cause
Location:
src/basic_memory/deps.py:61-68andsrc/basic_memory/deps.py:147-154The code was doing:
Instead of:
Solution
Added permalink normalization before database lookups in both functions:
generate_permalinkfrombasic_memory.utilsImpact
This bug would have caused:
Related
Similar to the fix in #345 for project deletion with permalink normalization.