slack-ruby / slack-ruby/slack-ruby-client

chat_postMessage inline code block with >4000 symbols broken markdown

Open
#259 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug?
Dominant language
Ruby
Stars
1.3k
Forks
222
Avg merge
1d 14h
Merged PRs (30d)
3

Description

I'm sending large inline code blocks into our slack rooms and blocks with more than 4000 symbols (roughly) are coming with a broken code style.

This message works fine:

"*test*\n```#{"x"*4000}```\n*test*"

This one came "broken":

"*test*\n```#{"x"*4100}```\n*test*"

It seems that the message is being split into two.
I'm not quite sure whether it's a gem's issue or an API problem.

The doc https://api.slack.com/methods/chat.postMessage#formatting says

For best results, limit the number of characters in the text field to 4,000 characters. Ideally, messages should be short and human-readable. Slack will truncate messages containing more than 40,000 characters.

Messages are not truncated though, just split.
Please guide where to look at.
I'm using v0.14.1 at the moment.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the chat_postMessage entry point and reproduce the issue using the two payloads in the report with 4,000 and 4,100 characters. Compare the client request and Slack response to determine whether splitting happens in slack-ruby-client or the Slack API; done means the cause and expected handling are established.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.