mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 05:41:51 +00:00
fix: additional checks for findTagByName
This commit is contained in:
parent
b490302cd4
commit
e43500abba
1 changed files with 9 additions and 2 deletions
|
@ -14,9 +14,16 @@ export async function findTagByName(
|
||||||
const categorySeparatorIndex = name.indexOf(".");
|
const categorySeparatorIndex = name.indexOf(".");
|
||||||
if (categorySeparatorIndex > 0) {
|
if (categorySeparatorIndex > 0) {
|
||||||
const categoryName = name.slice(0, categorySeparatorIndex);
|
const categoryName = name.slice(0, categorySeparatorIndex);
|
||||||
const tagName = name.slice(categorySeparatorIndex + 1);
|
if (!Object.hasOwn(config.categories, categoryName)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
const category = config.categories[categoryName];
|
||||||
|
|
||||||
return config.categories[categoryName]?.tags[tagName] ?? null;
|
const tagName = name.slice(categorySeparatorIndex + 1);
|
||||||
|
if (!Object.hasOwn(category.tags, tagName)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return category.tags[tagName];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dynamic tag
|
// Dynamic tag
|
||||||
|
|
Loading…
Add table
Reference in a new issue