From 6a5826248caff1458e7cb09b933d28d5f798fc55 Mon Sep 17 00:00:00 2001 From: Innei Date: Fri, 31 May 2024 11:44:08 +0800 Subject: [PATCH] fix: check slug length Signed-off-by: Innei --- apps/core/src/modules/post/post.service.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/core/src/modules/post/post.service.ts b/apps/core/src/modules/post/post.service.ts index c186ba5e46..27f95807a5 100644 --- a/apps/core/src/modules/post/post.service.ts +++ b/apps/core/src/modules/post/post.service.ts @@ -344,7 +344,9 @@ export class PostService { } async isAvailableSlug(slug: string) { - return (await this.postModel.countDocuments({ slug })) === 0 + return ( + slug.length > 0 && (await this.postModel.countDocuments({ slug })) === 0 + ) } async checkRelated<