Related to #1885. Workaround to avoid crashing when searching tags with dots like cubbi.es

What i did was to redirect to the tag without dots, in this case cubbies
I didn't consider a good idea to add route support for /tags/cubbi.es
since it get messed with request formats
This commit is contained in:
Gonzalo Rodriguez 2011-09-03 00:16:03 -03:00
parent c63dfb88fe
commit 0aeab944bf
2 changed files with 6 additions and 1 deletions

View file

@ -18,7 +18,7 @@ class PeopleController < ApplicationController
params[:q] ||= params[:term] || ''
if (params[:q][0] == 35 || params[:q][0] == '#') && params[:q].length > 1
redirect_to tag_path(:name => params[:q].gsub("#", ""))
redirect_to tag_path(:name => params[:q].gsub(/[#\.]/, ''))
return
end

View file

@ -72,6 +72,11 @@ describe PeopleController do
get :index, :q => '#babies'
response.should redirect_to('/tags/babies')
end
it 'goes to a tag page if you search for a hash with dots' do
get :index, :q => '#babi.es'
response.should redirect_to('/tags/babies')
end
end
describe '#tag_index' do