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

regex failing on check of hardcoded links #10205

Closed
nicoa opened this issue Feb 17, 2022 · 0 comments · Fixed by #10263
Closed

regex failing on check of hardcoded links #10205

nicoa opened this issue Feb 17, 2022 · 0 comments · Fixed by #10263

Comments

@nicoa
Copy link
Contributor

nicoa commented Feb 17, 2022

Describe the bug

#9800 (contained in release 4.4.0) introduced an issue on our side for extlinks that contain special characters.

the problematic part of code is re.compile(s.replace("%s", "(?P<value>.+)")). a possible fix is re.compile(re.escape(s).replace("%s", "(?P<value>.+)")).

Would you be happy to receive a PR on this?

How to Reproduce

use:

extlinks = {
    "package": (
        r"https://gitlab.com/path_to_my_project/-/packages?search[]=%s",
        "package %s",
    ),
}

this will lead to re.error: unterminated character set at position 88 when any link is found on the parsed page.

Expected behavior

No response

Your project

sorry, nothing I can share - let me know if a reproducing example is required

Screenshots

No response

OS

Unix, Mac

Python version

3.9

Sphinx version

4.4.0

Sphinx extensions

extlinks

Extra tools

No response

Additional context

No response

@nicoa nicoa added the type:bug label Feb 17, 2022
@tk0miya tk0miya added this to the 4.5.0 milestone Mar 27, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants