Skip to content

Commit

Permalink
fix: check slug length
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei committed May 31, 2024
1 parent 6595371 commit 6a58262
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion apps/core/src/modules/post/post.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<
Expand Down

0 comments on commit 6a58262

Please sign in to comment.