Skip to content

Commit b33dec1

Browse files
fix: strip # prefix from tags in isTaskFile for tag-based identification
Obsidian's metadata cache prepends '#' to frontmatter tag values (e.g., tags: [task] becomes ["#task"] in cache.frontmatter.tags). isTaskFile passes these raw values to matchesHierarchicalTagExact, which compares "#task" against the taskTag setting value "task" and fails to match. Strip the '#' prefix before comparing so tag-based task identification works correctly without requiring users to set taskTag to "#task".
1 parent 7963b82 commit b33dec1

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/utils/TaskManager.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,12 @@ export class TaskManager extends Events {
100100
} else {
101101
// Fallback to legacy tag-based method with hierarchical support
102102
if (!Array.isArray(frontmatter.tags)) return false;
103-
return frontmatter.tags.some((tag: string) =>
104-
typeof tag === 'string' && FilterUtils.matchesHierarchicalTagExact(tag, this.taskTag)
105-
);
103+
return frontmatter.tags.some((tag: string) => {
104+
if (typeof tag !== 'string') return false;
105+
// Obsidian metadata cache prepends '#' to frontmatter tags
106+
const cleanTag = tag.startsWith('#') ? tag.slice(1) : tag;
107+
return FilterUtils.matchesHierarchicalTagExact(cleanTag, this.taskTag);
108+
});
106109
}
107110
}
108111

0 commit comments

Comments
 (0)