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

Github issue/pull/discussion fragments with a ? at the end are ignored and raise a warning #320

Open
onerandomusername opened this issue Sep 19, 2024 · 2 comments

Comments

@onerandomusername
Copy link
Owner

URLs matched by the github link should not include question marks at the end of the url as that ends up raising an error. They should be removed and ignored.

The code where to perform this check is located around here:

if match.re is GITHUB_ISSUE_LINK_REGEX:
source_format = IssueSourceFormat.direct_github_url
# handle custom checks here
url = yarl.URL(match[0])
# don't match if we didn't end with the hash
if not url.path.rstrip("/").endswith(match.group("number")):
continue
if url.fragment or url.query: # used to match for comments later
fragment = url.fragment

@shiftinv
Copy link
Contributor

I can't think of a reason for a question mark to be there, is it really a common edge case for this?

@shiftinv
Copy link
Contributor

Did a tiny bit of testing for this - it's worth mentioning that github also doesn't directly handle links like this, opening https://github.com/onerandomusername/monty-python/issues/320#issuecomment-2363522065? doesn't scroll to the comment, for instance. They do seem to account for it in their markdown parser though, since putting that link into a comment as-is looks like this:

#320 (comment)?

I haven't looked into this much, but it at least looks like they handle ?, !, ., and , and display them after the link, and it just eats other special chars like + or &. *shrug*

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants