Allow specifying encoding of parameters by action #26092

Merged
merged 1 commit into from Aug 10, 2016

Projects

None yet

7 participants

@kerrizor
Contributor
kerrizor commented Aug 9, 2016

At GitHub we need to handle parameter encodings that are not UTF-8. This
patch allows us to specify encodings per parameter per action.

"We know that this doesn't handle nested parameters, but we don't really need that right now." -- @tenderlove

@matthewd matthewd was assigned by rails-bot Aug 9, 2016
@rails-bot

Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @matthewd (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

This repository is being automatically checked for code quality issues using Code Climate. You can see results for this analysis in the PR status below. Newly introduced issues should be fixed before a Pull Request is considered ready to review.

Please see the contribution instructions for more information.

@matthewd
Member
matthewd commented Aug 9, 2016

I'm slightly unsure about making this [only] action-specific; seems likely one might have a few well-known parameter names that are differently-encoded application wide. But I guess we can consider that later, if it starts to feel onerous.

Looks like we need a test to prove they are in fact action specific, though... AFAICS, the current tests would pass if we ignored action entirely. Ideally, I'd like to see a request where bar or baz doesn't change encoding (because the action doesn't match), and another showing that a second encoding definition for the same parameter name (but on a different action) also does the right thing.

@kerrizor
Contributor
kerrizor commented Aug 9, 2016

I'm slightly unsure about making this [only] action-specific; seems likely one might have a few well-known parameter names that are differently-encoded application wide. But I guess we can consider that later, if it starts to feel onerous.

Yeah, I had considered adding that, but it wasn't something we were using or needing ATM. Practically speaking, there were only 2-3 action/param combos that needed this.

@kerrizor kerrizor Allow specifying encoding of parameters by action
At GitHub we need to handle parameter encodings that are not UTF-8. This
patch allows us to specify encodings per parameter per action.
496d744
@kerrizor
Contributor
kerrizor commented Aug 9, 2016

@matthewd tests added!

@maclover7 maclover7 added the actionpack label Aug 9, 2016
@tenderlove tenderlove was assigned by maclover7 Aug 9, 2016
@tenderlove tenderlove merged commit 79e27b9 into rails:master Aug 10, 2016

1 check passed

codeclimate Code Climate didn't find any new or fixed issues.
Details
@kamipo kamipo added a commit to kamipo/rails that referenced this pull request Aug 11, 2016
@kamipo kamipo Fix actionview test failure
Caused by #26092.
7924be5
@rafaelfranca
Member

This is missing documentation. Can you send a new PR documenting this feature?

@kerrizor kerrizor deleted the kerrizor:kerrizor/force-param-encoding branch Aug 15, 2016
@zhu1230 zhu1230 referenced this pull request in drapergem/draper Sep 2, 2016
Merged

add compatibility with latest rails 5.1 #759

@arthurnn
Member

@rafaelfranca have we ever added the docs for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment