Summary
Project names are handled inconsistently between file-based project detection and plugin editing, causing the same project to appear as two separate entries.
Description
When a project is derived from an Obsidian file name, spaces are preserved in the project name. However, when tasks are edited through the plugin interface, project names have spaces converted to dashes for tag formatting. This creates inconsistent project naming that causes the same logical project to appear as separate entities.
Steps to Reproduce
- Create an Obsidian file named "My Project Name.md"
- Add a task that gets automatically assigned to the "My Project Name" project (via file-based detection)
- Edit a task through the plugin interface and assign it to the same project
- Observe that the plugin creates tags like
#project/My-Project-Name (with dashes)
- Notice that these appear as two different projects in project views
Expected Behavior
The same project should have consistent naming regardless of whether it's detected from file names or assigned through plugin editing.
Actual Behavior
- File-based detection: Project appears as "My Project Name" (spaces preserved)
- Plugin editing: Project appears as "My-Project-Name" (spaces converted to dashes)
Technical Details
Root Cause
Inconsistent normalization between two code paths:
1. File name parsing (src/parsers/file-metadata-parser.ts:402-403)
const fileName = filePath.split('/').pop() || filePath;
return fileName.replace(/\.md$/i, '');
Preserves spaces in project names
2. Task writing (src/dataflow/api/WriteAPI.ts:402-405)
const sanitizedProject = String(args.project)
.trim()
.replace(/\s+/g, "-");
metadata.push(`#${projectPrefix}/${sanitizedProject}`);
Converts spaces to dashes for tag formatting
Suggested Solution
Standardize project name normalization across both parsing and writing processes by either:
- Always converting spaces to dashes in both file name parsing and tag generation
- Using a consistent project identifier that handles spaces properly in both contexts
- Implementing a centralized project name normalization function used by both code paths
Environment
- Task Genius version: 9.8.14
- Impact: Project organization and filtering functionality
Summary
Project names are handled inconsistently between file-based project detection and plugin editing, causing the same project to appear as two separate entries.
Description
When a project is derived from an Obsidian file name, spaces are preserved in the project name. However, when tasks are edited through the plugin interface, project names have spaces converted to dashes for tag formatting. This creates inconsistent project naming that causes the same logical project to appear as separate entities.
Steps to Reproduce
#project/My-Project-Name(with dashes)Expected Behavior
The same project should have consistent naming regardless of whether it's detected from file names or assigned through plugin editing.
Actual Behavior
Technical Details
Root Cause
Inconsistent normalization between two code paths:
1. File name parsing (
src/parsers/file-metadata-parser.ts:402-403)Preserves spaces in project names
2. Task writing (src/dataflow/api/WriteAPI.ts:402-405)
Converts spaces to dashes for tag formatting
Suggested Solution
Standardize project name normalization across both parsing and writing processes by either:
Environment