File tree Expand file tree Collapse file tree 3 files changed +18
-3
lines changed Expand file tree Collapse file tree 3 files changed +18
-3
lines changed Original file line number Diff line number Diff line change 18
18
- chore: bump jinja2 to 3.1.5 and requests to 2.32.0 (#1714)
19
19
- Fix: situationally broken apropos command (#1711)
20
20
- chore: bump requests to 2.32.3 (#1715)
21
+ - Fix: Newlines replaced with spaces in botcmd args (#1716)
21
22
- chore: bump jinja2 to 3.1.6 (#1723)
22
23
- chore: update errbot-backend-slackv3 version to 0.3.1 (#1725)
23
24
Original file line number Diff line number Diff line change @@ -325,21 +325,25 @@ def process_message(self, msg: Message) -> bool:
325
325
prefixed = True
326
326
327
327
text = text .strip ()
328
- text_split = text .split ()
329
328
cmd = None
330
329
command = None
331
330
args = ""
332
331
if not only_check_re_command :
333
- i = len (text_split )
332
+ first = True
333
+ i = len (text .split ())
334
334
while cmd is None :
335
+ # maxsplit so we can preserve linebreaks and other whitespace in args
336
+ text_split = text .split (maxsplit = i )
335
337
command = "_" .join (text_split [:i ])
336
338
337
339
with self ._gbl :
338
340
if command in self .commands :
339
341
cmd = command
340
- args = " " .join (text_split [i :])
342
+ if not first :
343
+ args = text_split [- 1 ]
341
344
else :
342
345
i -= 1
346
+ first = False
343
347
if i <= 0 :
344
348
break
345
349
Original file line number Diff line number Diff line change @@ -57,6 +57,16 @@ def test_echo(testbot):
57
57
assert "foo" in testbot .exec_command ("!echo foo" )
58
58
59
59
60
+ def test_echo_newline_args (testbot ):
61
+ # https://github.com/errbotio/errbot/issues/1307
62
+ assert testbot .exec_command ("!echo\n foo\n bar" ).startswith ("foo" )
63
+
64
+
65
+ def test_echo_newline_preserved (testbot ):
66
+ # https://github.com/errbotio/errbot/issues/1716
67
+ assert "\n " in testbot .exec_command ("!echo foo\n bar" )
68
+
69
+
60
70
def test_status_gc (testbot ):
61
71
assert "GC 0->" in testbot .exec_command ("!status gc" )
62
72
You can’t perform that action at this time.
0 commit comments