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

reddit: fix shortlinks #2202

Merged
merged 1 commit into from
Oct 29, 2021
Merged

reddit: fix shortlinks #2202

merged 1 commit into from
Oct 29, 2021

Conversation

half-duplex
Copy link
Member

Description

reddit.py doesn't correctly handle redd.it shortlinks (anymore), and doesn't handle reddit.com shortlinks at all.

< xnaas> https://redd.it/qhoy7z
<+Sopel> Unexpected error (no such group) from xnaas at 2021-10-29 15:15:13.406136. Message was: https://redd.it/qhoy7z

This makes the "comment" group optional, and adds the "submission" group name and reddit.com domain to the shortlink regex.

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 quality and make test)
  • I have tested the functionality of the things this change touches

@half-duplex half-duplex added the Bugfix Generally, PRs that reference (and fix) one or more issue(s) label Oct 29, 2021
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.

Buh, it's always something with this plugin. Nice catch from @xnaas and quick fix by @half-duplex.

@dgw dgw added this to the 7.1.6 milestone Oct 29, 2021
@dgw dgw merged commit 1010e45 into sopel-irc:master Oct 29, 2021
dgw added a commit that referenced this pull request Oct 29, 2021
reddit: fix shortlinks

Corresponds to merge on master: 1010e45
dgw added a commit that referenced this pull request Nov 7, 2021
Addresses a regression introduced by #2202, which added `reddit.com` to
the `short_post_url` pattern and made it possible for a post or comment
URL to match BOTH that and `post_or_comment_url`.

Since URLs match individually, and not as part of the line, all we need
to make sure a shortlink really is one is to ensure that the link ends
after the submission ID and optional trailing slash.
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.

2 participants