diff --git a/internal/txlib/utils.go b/internal/txlib/utils.go index 38f0c53..bd2f792 100644 --- a/internal/txlib/utils.go +++ b/internal/txlib/utils.go @@ -225,8 +225,8 @@ func truncateMessage(message string) string { maxLength = 0 } - if len(message) > maxLength { - return message[:maxLength-2] + ".." + if len(message) > maxLength && maxLength > 0 { + return message[:maxLength] + ".." } return message } diff --git a/internal/txlib/utils_test.go b/internal/txlib/utils_test.go index 17a971d..ed7a4cd 100644 --- a/internal/txlib/utils_test.go +++ b/internal/txlib/utils_test.go @@ -86,7 +86,7 @@ func TestTruncateMessage(t *testing.T) { ) assert.Equal( t, - "this is a long message that needs to be truncated because it exceeds the max..", + "this is a long message that needs to be truncated because it exceeds the maxim..", result, )