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

wikipedia: fix urlparse usage & handle Special: namespace #2575

Merged
merged 2 commits into from
Dec 3, 2023

Conversation

SnoopJ
Copy link
Contributor

@SnoopJ SnoopJ commented Nov 29, 2023

Description

Closes #2573.

This changeset corrects errant usage of urllib.parse.urlparse() in the wikipedia plugin, fixing a regression introduced by #2414. This fix prevents namespaces from being erroneously discarded.

In the process of this fix, I discovered that the Special:* namespace is a special case as far as the MediaWiki API is concerned, queries to the API for pages in this namespace don't do what you might expect, so these pages cannot be located and turned into snippets for IRC. So, instead, the URL rule ignores these pages, and issues a specific explanation if a user tries to query them using a command.

Checklist

  • I have read CONTRIBUTING.md
  • I can and do license this contribution under the EFLv2
  • No issues are reported by make qa (runs make lint and make test)
  • I have tested the functionality of the things this change touches

@SnoopJ SnoopJ added the Bugfix Generally, PRs that reference (and fix) one or more issue(s) label Nov 29, 2023
@SnoopJ SnoopJ added this to the 8.0.0 milestone Nov 29, 2023
@SnoopJ SnoopJ self-assigned this Nov 29, 2023
@SnoopJ SnoopJ changed the title Bugfix/gh2573 fix urlparse usage wikipedia: fix urlparse usage Nov 29, 2023
@SnoopJ SnoopJ force-pushed the bugfix/gh2573-fix-urlparse-usage branch from a8d7c1e to 9c4c113 Compare November 29, 2023 23:34
@dgw dgw requested a review from a team November 29, 2023 23:35
Copy link
Member

@dgw dgw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I've already played with the patched plugin in your bot's test channel, I only have nitpicks left.

sopel/builtins/wikipedia.py Outdated Show resolved Hide resolved
sopel/builtins/wikipedia.py Outdated Show resolved Hide resolved
sopel/builtins/wikipedia.py Outdated Show resolved Hide resolved
sopel/builtins/wikipedia.py Outdated Show resolved Hide resolved
Copy link
Member

@dgw dgw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thought this PR had been made ready to go, but apparently not. Good to squash, and if you're feeling extra on-top-of-things you can make sure the draft changelog you've been working on reflects both bugfixes from here. 😉

@SnoopJ SnoopJ force-pushed the bugfix/gh2573-fix-urlparse-usage branch from 5ac0c1e to 43b56a4 Compare December 3, 2023 21:52
@dgw dgw changed the title wikipedia: fix urlparse usage wikipedia: fix urlparse usage & handle Special: namespace Dec 3, 2023
@dgw dgw merged commit 120477f into sopel-irc:master Dec 3, 2023
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bugfix Generally, PRs that reference (and fix) one or more issue(s)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

wikipedia: results for namespaces/articles with colons in title are surprising
2 participants