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

tag: Fix bug in redirect tag matching #731

Merged

Conversation

Amorymeltzer
Copy link
Collaborator

Some redirect tags (e.g. {{R from alternative language}}) can take parameters (e.g. "|from=de|to=fr"), which would cause the regex to fail to match the entire pagetext. Specifically, in:

(?:[^|{}]|{{[^}]}})+

the

{{[^}]*}}

portion matches individual redirect templates, and removing the pipe from [^|}] allows the content of that template to contain parameters.

Previously, the tag module would just fail, and the regex might just insert new tags in the middle of already-existing templates.

Not sure what the case theoretically was where not excluding a pipe here would cause an issue.

Some redirect tags (e.g. {{R from alternative language}}) can take parameters (e.g. "|from=de|to=fr"), which would cause the regex to fail to match the entire pagetext.  Specifically, in:

(?:[^|{}]*|{{[^}]*}})+

the

{{[^}]*}}

portion matches individual redirect templates, and removing the pipe from [^|}] allows the content of that template to contain parameters.

Previously, the tag module would just fail, and the regex might just insert new tags in the middle of already-existing templates.
@Amorymeltzer Amorymeltzer added this to the November 2019 update milestone Oct 19, 2019
@Amorymeltzer Amorymeltzer merged commit c17b5a8 into wikimedia-gadgets:master Nov 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant