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

Treat type_start in Mojolicious::Routes::Pattern as a character instead of a regex #1616

Merged
merged 1 commit into from
Nov 29, 2020

Conversation

Grinnz
Copy link
Contributor

@Grinnz Grinnz commented Nov 28, 2020

Summary

The type_start character passed to split is currently being treated as a regex but it should be treated as a string to split on.

Motivation

The type_start attribute is meant to be a single character that delimits a placeholder name from its type. It was being
passed directly to split and thus used as a regex, which means any regex metacharacters would break the parsing.
Interpolate it with \Q to apply quotemeta to the character for use in split, and add tests for custom placeholder
characters.

References

t/mojolicious/pattern.t Outdated Show resolved Hide resolved
…ad of a regex

The type_start attribute is meant to be a single character that delimits a placeholder name from its type. It was being
passed directly to split and thus used as a regex, which means any regex metacharacters would break the parsing.
Interpolate it with \Q to apply quotemeta to the character for use in split, and add tests for custom placeholder
characters.
@Grinnz Grinnz force-pushed the Grinnz/route_pattern_start_regex branch from 4c8b303 to 4f7dfd6 Compare November 28, 2020 20:24
@Grinnz Grinnz requested a review from a team November 28, 2020 20:30
@kraih kraih requested a review from a team November 28, 2020 20:31
Copy link
Member

@marcusramberg marcusramberg left a comment

Choose a reason for hiding this comment

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

lgtm.

@mergify mergify bot merged commit 0ba1809 into master Nov 29, 2020
@Grinnz Grinnz deleted the Grinnz/route_pattern_start_regex branch November 29, 2020 18:57
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

Successfully merging this pull request may close these issues.

3 participants