summaryrefslogtreecommitdiffstats
path: root/api/import.go
diff options
context:
space:
mode:
Diffstat (limited to 'api/import.go')
-rw-r--r--api/import.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/api/import.go b/api/import.go
index 6696aef14..a6db73126 100644
--- a/api/import.go
+++ b/api/import.go
@@ -20,7 +20,10 @@ import (
//
func ImportPost(post *model.Post) {
- for messageRuneCount := utf8.RuneCountInString(post.Message); messageRuneCount > 0; messageRuneCount = utf8.RuneCountInString(post.Message) {
+ // Workaround for empty messages, which may be the case if they are webhook posts.
+ firstIteration := true
+ for messageRuneCount := utf8.RuneCountInString(post.Message); messageRuneCount > 0 || firstIteration; messageRuneCount = utf8.RuneCountInString(post.Message) {
+ firstIteration = false
var remainder string
if messageRuneCount > model.POST_MESSAGE_MAX_RUNES {
remainder = string(([]rune(post.Message))[model.POST_MESSAGE_MAX_RUNES:])