rails / journey

A router for rails
221 stars 57 forks source link

unicode urls and redirection #28

Closed pwim closed 12 years ago

pwim commented 12 years ago

I have a site with URLs that include escaped utf-8, like http://kanjidamage.com/kanji/4-total-%E4%BA%86

I want to redirect from www to the naked domain, so I added the following to my routes

constraints(:host => "www.kanjidamage.com") do
  match '*source', to: redirect("http://kanjidamage.com/%{source}")
  root to: redirect("http://kanjidamage.com/")
end

The issue is, source gets escaped to for example /kanji/4-total-了, which then redirects to http://kanjidamage.com/kanji/4-total-了, which is an invalid url and everything blows up.

Normally unescaping %encoding is a good thing, but this time it is biting me. I'm not sure if this is a bug or not, but I couldn't come up with a workaround.

pixeltrix commented 12 years ago

This sounds the same as rails/rails#5688 which I fixed in: https://github.com/rails/rails/commit/958daaa664079ec32e542dc3dec52dfd504aecde

Can you check whether this fixes your problem - thanks.

pwim commented 12 years ago

Yes, that it addressing the same issue I was having.