Skip to content

[6.x] Change urlencode and rawurlencode modifiers to not ignore forward slashes #11812

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

Merged
merged 2 commits into from
Jun 20, 2025

Conversation

ryanmitchell
Copy link
Contributor

@ryanmitchell ryanmitchell commented May 22, 2025

This PR changes the rawurlencode and urlencodemodifiers to not ignore forward slashes.

it adds rawurlencode_except_slashes and urlencode_except_slashes modifiers

So:
{{ "please and thank you/Mommy" | rawurlencode }}
returns
please%20and%20thank%20you%2FMommy

{{ "please and thank you/Mommy" | rawurlencode_except_slashes }}
returns
please%20and%20thank%20you/Mommy

Closes #11470

Copy link
Member

@jasonvarga jasonvarga left a comment

Choose a reason for hiding this comment

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

Let's just target master and break it. For both urlencode and rawurlencode. I can't find a solid reason for why we did that ~8 years ago.

We can create urlencode_except_slashes and rawurlencode_except_slashes modifiers that have the existing behavior.

@ryanmitchell ryanmitchell changed the base branch from 5.x to master June 20, 2025 07:26
@ryanmitchell
Copy link
Contributor Author

@jasonvarga thats done

@duncanmcclean duncanmcclean changed the title [5.x] Add an option to rawurlencode to not ignore forward slashes [ 6.x] Add an option to rawurlencode to not ignore forward slashes Jun 20, 2025
@duncanmcclean duncanmcclean changed the title [ 6.x] Add an option to rawurlencode to not ignore forward slashes [6.x] Add an option to rawurlencode to not ignore forward slashes Jun 20, 2025
@ryanmitchell ryanmitchell changed the title [6.x] Add an option to rawurlencode to not ignore forward slashes [6.x] Change urlencode and rawurlencode modifiers to not ignore forward slashes Jun 20, 2025
@jasonvarga jasonvarga merged commit 3a16aea into statamic:master Jun 20, 2025
29 checks passed
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.

rawurlencode does not encode forward slashes
2 participants