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

Add option to decide what to do on invalid UTF-8 urlencoded params #1159 #1192

Closed
wants to merge 15 commits into from

Conversation

bradhanks
Copy link
Contributor

I added the ability to set any status code when utf8 validation fails. It's somewhat related to the issue #1159.

I'm expecting that nothing will be useable as is, but I'm happy to make edits.

What I lack in exp, I make up in enthusiasm?

…ks/plug into plug_builder_documentation_edits
* added  :validate_utf8_error option to plug/lib/plug/parsers/urlencoded.ex
* added  :validate_utf8_error option to plug/lib/plug/parsers/multipart.ex
* refactored Plug.Conn.Utils.validate_utf8! to return binary or exception
* added :validate_utf8_error option to plug/lib/plug/parsers.ex
* added :validate_utf8_error to plug/lib/plug/conn/query.ex
* refactored plug/lib/plug/conn/query.ex to remove rescue, and remove "if" conditional
* refactored Plug.BadResponseError to support different client request errors
* refactored Plug BadRequestError / added Plug.BadResponseError to support status codes and messages
* Plug.Conn.Utils.validate_utf8! support for any status code
* Plug.Conn.Utils.validate_utf8! keeps binary value in state
* minor edits to Plug.Conn
@josevalim
Copy link
Member

Hi @bradhanks ! The change should be smaller than here. Inside the validate_utf8! function, you can call Application.get_env and read the status code we are meant to use. :)

@bradhanks bradhanks closed this Dec 23, 2023
@bradhanks bradhanks deleted the utf8_error branch December 23, 2023 03:38
@bradhanks
Copy link
Contributor Author

Sorry I did not mean to close this. I have it done I think. I'm just writing some tests.

@bradhanks
Copy link
Contributor Author

bradhanks commented Dec 27, 2023

Created new PR #1200

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.

2 participants