Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tell: argument splitting/stripping is a bit broken #2157

Closed
dgw opened this issue Jul 12, 2021 · 0 comments · Fixed by #2162
Closed

tell: argument splitting/stripping is a bit broken #2157

dgw opened this issue Jul 12, 2021 · 0 comments · Fixed by #2162
Labels
Bug Things to squish; generally used for issues Medium Priority
Milestone

Comments

@dgw
Copy link
Member

dgw commented Jul 12, 2021

This code line removes most IRC formatting bytes from the beginning of the message:

msg = trigger.group(2).lstrip(tellee).lstrip()

It's similar to another issue (#1877) we fixed in choose for 7.1 (#1965). The second .lstrip() with no arguments needs to be replaced with this plugin's own version of _format_safe() from choose.py.

In fact, it wouldn't take much at this point to convince me that Sopel's API should include its own formatting-safe versions of strip(), lstrip(), and rstrip(). Issues like this keep coming up, and stuff like trigger.plain won't help…


That line also misuses .lstrip() with the tellee's nick. That isn't a huge issue, because it's never going to go past the whitespace, but it could cause other quirks like the fact that punctuation gets through even though the code's intent appears to be treating the tellee as a separate argument that isn't part of the message:

<~dgw> ;tell Creator|TL, comma test
[…]
<&Kaede> [tell] Creator|TL: Monday, July 12, 2021 22:52:44 (IST) <dgw> tell Creator|TL , comma test
@dgw dgw added Bug Things to squish; generally used for issues Medium Priority labels Jul 12, 2021
@dgw dgw added this to the 7.1.3 milestone Jul 12, 2021
@dgw dgw closed this as completed in #2162 Aug 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Things to squish; generally used for issues Medium Priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant