3
0
Fork 0
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:
Dragory 2023-04-01 23:51:29 +03:00
parent b490302cd4
commit e43500abba
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1

View file

@ -14,9 +14,16 @@ export async function findTagByName(
const categorySeparatorIndex = name.indexOf(".");
if (categorySeparatorIndex > 0) {
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