From 09335ea99f70a9c05162d81ba071be915053665d Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Mon, 25 Nov 2024 00:33:57 +0800 Subject: [PATCH] :bug: Fix count post content length --- pkg/internal/services/posts.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/internal/services/posts.go b/pkg/internal/services/posts.go index 0920af5..79a1ca5 100644 --- a/pkg/internal/services/posts.go +++ b/pkg/internal/services/posts.go @@ -477,11 +477,11 @@ func TruncatePostContent(post models.Post) models.Post { if post.Body["content"] != nil { if val, ok := post.Body["content"].(string); ok { length := TruncatePostContentThreshold + post.Body["content_length"] = len([]rune(val)) if len([]rune(val)) >= length { post.Body["content"] = string([]rune(val)[:length]) + "..." post.Body["content_truncated"] = true } - post.Body["content_length"] = len([]rune(val)) } }