Closed dgw closed 3 years ago
If someone links a template URL with a section fragment, Sopel outputs an unexpected error.
[2021-07-24 17:12:47,036] sopel.bot ERROR - Unexpected error ('parse') from dgw at 2021-07-24 22:12:47.036637. Message was: https://en.wikipedia.org/wiki/Template:Infobox_company#TemplateData Traceback (most recent call last): File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/sopel/bot.py", line 757, in call_rule rule.execute(sopel, trigger) File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/sopel/plugins/rules.py", line 1057, in execute exit_code = self._handler(bot, trigger) File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/sopel/plugins/rules.py", line 1608, in execute_handler return handler(bot, trigger, match=trigger) File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/sopel/modules/wikipedia.py", line 256, in mw_info say_section(bot, trigger, match.group(1), unquote(match.group(2)), unquote(match.group(3))) File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/sopel/modules/wikipedia.py", line 204, in say_section snippet = mw_section(server, query, section) File "/data/data/com.termux/files/usr/lib/python3.9/site-packages/sopel/modules/wikipedia.py", line 240, in mw_section parser.feed(data['parse']['text']['*']) KeyError: 'parse'
.version
/version
The same template URL with no fragment yields a perfectly functional, but useless, empty snippet.
<SopelTest> [wikipedia] Template:Infobox company | ""
Bit more digging in API docs and test requests, and I should have a patch for this tonight.
Description
If someone links a template URL with a section fragment, Sopel outputs an unexpected error.
Logs
Environment
.version
: 7.1.2/version
: plexus-4(hybrid-8.1.20)(20200510_0-610). irc.rizon.ca TS6owNotes
The same template URL with no fragment yields a perfectly functional, but useless, empty snippet.