diff --git a/app/views/search/_directory.rhtml b/app/views/search/_directory.rhtml
index 7c372fc..246887a 100644
--- a/app/views/search/_directory.rhtml
+++ b/app/views/search/_directory.rhtml
@@ -1,6 +1,6 @@
- <%= link_to_unless(params[:initial].blank?, _('Recent'), :action => 'assets', :display => params[:display]) %>
+ <%= link_to_unless(params[:initial].blank?, _('Recent'), params.merge(:action => 'assets', :initial => nil)) %>
- <%= (?a..?z).map { |initial| link_to_unless(params[:initial] == ('' << initial), ('' << initial).upcase, :action => 'directory', :asset => @asset, :initial => ('' << initial), :display => params[:display]) }.join(' ') %>
+ <%= ('a'..'z').map { |initial| link_to_unless(params[:initial] == initial, initial.upcase, params.merge(:action => 'directory', :asset => @asset, :initial => initial)) }.join(' ') %>
diff --git a/test/functional/search_controller_test.rb b/test/functional/search_controller_test.rb
index 34f284a..f872688 100644
--- a/test/functional/search_controller_test.rb
+++ b/test/functional/search_controller_test.rb
@@ -519,6 +519,12 @@ class SearchControllerTest < Test::Unit::TestCase
assert_tag :tag => 'a', :attributes => { :href => '/assets/people' }, :content => 'Recent'
end
+ should 'not leave category in link to other char in directory' do
+ cat = Category.create!(:name => 'just_a_category', :environment => Environment.default)
+ get :directory, :asset => 'people', :initial => 'r', :category_path => cat.path.split('/')
+ assert_tag :tag => 'a', :attributes => { :href => "/directory/people/k/#{cat.path}" }
+ end
+
############### directory for every kind of asset #################
should 'display people with a given initial' do
included = create_user('fergunson').person
--
libgit2 0.21.2