Project

General

Profile

Bug #15391

Hostgroup host links not quoted

Added by Mac Reid over 4 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Low
Assignee:
Category:
Host groups
Target version:
Difficulty:
trivial
Triaged:
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

When clicking on a link for hosts in a hostgroup, the link does not quote the hostgroup name. When there is a space in the hostgroup name, the linked search does not show any hosts.

Steps to reproduce:

Create hostgroup with a space in the name.
Create host and add it to the newly created hostgroup.
On the hostgroups webpage, click on the hosts link for the newly created hostgroup.

The fix I applied on my Foreman instance:

diff --git a/app/views/hostgroups/index.html.erb b/app/views/hostgroups/index.html.erb
index d427bb9..ad6adf9 100644
--- a/app/views/hostgroups/index.html.erb
+++ b/app/views/hostgroups/index.html.erb
@@ -18,10 +18,10 @@
           <%= label_with_link(hostgroup, 150, authorizer) %>
         </td>
         <td>
-          <%= link_to hostgroup.hosts_count, hosts_path(:search => "hostgroup_fullname = #{hostgroup.title}") %>
+          <%= link_to hostgroup.hosts_count, hosts_path(:search => %Q[hostgroup_fullname = "#{hostgroup.title}"]) %>
         </td>
         <td>
-          <%= link_to hostgroup.children_hosts_count, hosts_path(:search => "parent_hostgroup = #{hostgroup.title}") %>
+          <%= link_to hostgroup.children_hosts_count, hosts_path(:search => %Q[parent_hostgroup = "#{hostgroup.title}"]) %>
         </td>
         <td>
           <%= action_buttons(

Associated revisions

Revision e36fb9fe (diff)
Added by Mac Reid over 4 years ago

fixes #15391 - quote host group search links

Revision 0a339655 (diff)
Added by Mac Reid over 4 years ago

fixes #15391 - quote host group search links

(cherry picked from commit e36fb9feb383fb90d10118829745cb15395e0c7e)

History

#1 Updated by Dominic Cleal over 4 years ago

  • Difficulty set to trivial

If you'd like to get your patch included, please do open up a pull request with the instructions at https://theforeman.org/contribute.html - just commit it with a message similar to "fixes #15391 - quote host group search links".

#2 Updated by The Foreman Bot over 4 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/3589 added

#3 Updated by Dominic Cleal over 4 years ago

  • Assignee set to Mac Reid
  • Legacy Backlogs Release (now unused) set to 161

#4 Updated by Mac Reid over 4 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF