fix: Trim whitespace from category and tag names in URL generation (#437)

This commit is contained in:
Katsuyuki Karasawa
2025-05-05 09:57:34 +09:00
committed by GitHub
parent 7f0c109b17
commit 2b3d7cf304
9 changed files with 143 additions and 24 deletions
+7 -3
View File
@@ -67,9 +67,13 @@ export async function getCategoryList(): Promise<Category[]> {
count[ucKey] = count[ucKey] ? count[ucKey] + 1 : 1;
return;
}
count[post.data.category] = count[post.data.category]
? count[post.data.category] + 1
: 1;
const categoryName =
typeof post.data.category === "string"
? post.data.category.trim()
: String(post.data.category).trim();
count[categoryName] = count[categoryName] ? count[categoryName] + 1 : 1;
});
const lst = Object.keys(count).sort((a, b) => {