File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
slack_cli/lib/src/commands Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -116,7 +116,7 @@ class PostCommand extends Command<int> {
116116 final parsedBlocks = parseBlocks (blocks, logger: _logger);
117117
118118 // need to split into multiple messages of up to 50 blocks
119- final numberOfMessages = ( parsedBlocks.length / 50 ).ceil ();
119+ final numberOfMessages = math. max ( 1 , ( parsedBlocks.length / 50 ).ceil () );
120120
121121 final responses = < PostCommandResponse > [];
122122 for (var messageIndex = 0 ;
@@ -136,7 +136,7 @@ class PostCommand extends Command<int> {
136136 'text' : message,
137137 'unfurl_media' : unfurlMedia.toString (),
138138 'unfurl_links' : unfurlLinks.toString (),
139- 'blocks' : jsonEncode (blocksSublist),
139+ if (blocksSublist.isNotEmpty) 'blocks' : jsonEncode (blocksSublist),
140140 },
141141 );
142142 if (response.statusCode == 200 ) {
You can’t perform that action at this time.
0 commit comments