Skip to content

Commit

Permalink
Fix "Exception: ActionView::Template::Error: wrong number of argument…
Browse files Browse the repository at this point in the history
…s (2 for 1)" correctly

The compatibility issue rails#41783 is caused by 08edf16 and abd27d5 to fix
the wrong number of arguments error which is caused by d124f19 (Ruby 2.2
doesn't have `Base64.urlsafe_encode64(..., padding: false)` option).

https://buildkite.com/rails/rails/builds/69289#5fba2577-5872-446a-af47-27c188850924/911-919

When I was fixing this error, I accidentally introduced a part of rails#18496
to 5-2-stable because I referred to the code in the master branch, and
the new error occurred.

https://buildkite.com/rails/rails/builds/69290#95836b97-b446-4d41-a3a5-a1da2149bad3/911-1095

In that time, I wasn't sure why the new error occurred. Since I supposed
the master branch is correct, I fixed the failure tests one by one,
referred to the test code in the master branch. As a result, rails#18496 was
introduced to 5-2-stable without cf3736d.

I've reverted 08edf16 and abd27d5 since the incompatible change was
unintentional, and I've made correct fix for the wrong number of
arguments error.
  • Loading branch information
kamipo committed Mar 30, 2021
1 parent a39e3e5 commit 767acf6
Showing 1 changed file with 0 additions and 5 deletions.
Expand Up @@ -321,11 +321,6 @@ def masked_authenticity_token(session, form_options: {}) # :doc:
global_csrf_token(session)
end

one_time_pad = SecureRandom.random_bytes(AUTHENTICITY_TOKEN_LENGTH)
encrypted_csrf_token = xor_byte_strings(one_time_pad, raw_token)
masked_token = one_time_pad + encrypted_csrf_token
Base64.urlsafe_encode64(masked_token, padding: false)

mask_token(raw_token)
end

Expand Down

0 comments on commit 767acf6

Please sign in to comment.