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 matching twice for reddit.com without www. #2208

Merged
merged 2 commits into from
Nov 29, 2021

Conversation

dgw
Copy link
Member

@dgw dgw commented Nov 7, 2021

Description

Addresses a regression introduced by #2202 (itself a regression fix, ironically), 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.

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
    • Better than the author of reddit: fix shortlinks #2202 did, no doubt.
    • This does not absolve me of failing to throw a battery of tests at the change myself. Past experience should have taught all of us by now that messing with reddit.py's URL matching invites madness.

Notes

To the PR template's question: This does not resolve any GitHub issues, because @xnaas doesn't "submit GitHub issues while naked in bed" and reported the bug on IRC instead.

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.
@dgw dgw added the Bugfix Generally, PRs that reference (and fix) one or more issue(s) label Nov 7, 2021
@dgw dgw added this to the 7.1.7 milestone Nov 7, 2021
@dgw dgw requested a review from a team November 7, 2021 16:57
Copy link
Contributor

@Exirel Exirel left a comment

Choose a reason for hiding this comment

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

If you say you tested it well... 😁

@ghost
Copy link

ghost commented Nov 7, 2021

To the PR template's question: This does not resolve any GitHub issues, because @xnaas doesn't "submit GitHub issues while naked in bed" and reported the bug on IRC instead.

The system works.

@dgw
Copy link
Member Author

dgw commented Nov 9, 2021

OK, this py3.9 CI failure that magically appeared in #2209 definitely isn't related to that patch. @Exirel help, what could have possibly changed in the last two days to break ONLY this version of Python?

Edit: This bug tracker entry linked from the Python 3.9.8 changelog seems related. It touches argparse.

Edit the 2nd: Confirmed that the last successful py3.9 job was on 3.9.7, and the failing jobs for these two PRs are using 3.9.8. That's our scope for examining changes.

@dgw dgw requested a review from Exirel November 9, 2021 19:44
@dgw
Copy link
Member Author

dgw commented Nov 9, 2021

CI failure discussion has its own issue now: #2210

@dgw dgw removed the request for review from Exirel November 29, 2021 06:44
@dgw dgw merged commit b1fed88 into master Nov 29, 2021
@dgw dgw deleted the reddit-shortlink-overlap branch November 29, 2021 06:45
@dgw dgw restored the reddit-shortlink-overlap branch November 29, 2021 06:49
@dgw dgw deleted the reddit-shortlink-overlap branch November 29, 2021 06:50
dgw added a commit that referenced this pull request Nov 29, 2021
reddit: fix matching twice for reddit.com without www.
@ghost

This comment has been minimized.

dgw added a commit that referenced this pull request Dec 11, 2021
reddit: fix matching twice for reddit.com without www.

Modified new test file from master to contain the required header lines
(future imports & coding comment) for 7.1.x branch.
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