开发者

Rails 3.1 authenticity_token + uploadify

开发者 https://www.devze.com 2023-04-10 02:46 出处:网络
I am trying to use Uploadify with my Rails 3.1 app, i\'ve went through all the steps (middleware, initializers, config ...etc) and i think they are all working good but for one thing, my authenticity

I am trying to use Uploadify with my Rails 3.1 app, i've went through all the steps (middleware, initializers, config ...etc) and i think they are all working good but for one thing, my authenticity token is being "evaluated" somewhere in the process and the (+) plus signs are then turned into spaces! .. my original token is

<meta con开发者_JAVA百科tent="GS19lVJNr+/6ghijiM/hNZbo9a89I64nn1Sg+1zbqC8=" name="csrf-token" />

while the one that i see on the console is

"authenticity_token"=>"GS19lVJNr /6ghijiM/hNZbo9a89I64nn1Sg 1zbqC8="

and this of course results in "Cant' verify authenticity token" error and then the request is redirected to elsewhere.

any ideas on that? thank you.


do you encode it?

If you're using something like encodeURIComponent try it like so:

encodeURI(encodeURIComponent(token))

or just try to encode/decode the token right in the firebug/chrome tools to see what's happening

EDIT

that's weird. Can you please show the entire scriptData you're sending?


...had the same problem in Rails 3.2.9 but in my case the reason was that I was using this middleware which is ment for Rails 3.0 , once I removed it it was working

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号