Bug #6710
Cannot edit host group if its name only contains UTF-8 characters
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1121755
Description of problem:
Created a new hostgroup with the name '쥄㣆ꢕ䗀ᖑᆰ뒘礋捖䱣쒀䴮쏩騬橌矄ⱅರ㪷澘쨼' then tried to edit it via the web ui. As soon as I click the link for the hostgroup I get a page stating:
Host Group Not Found
I noticed that the URL being accessed is missing the name for the hostgroup:
/hostgroups/2-/edit
The URL should have the name of the hostgroup after its index:
/hostgroups/2-<NAME GOES HERE>/edit
Version-Release number of selected component (if applicable):
- apr-util-ldap-1.3.9-3.el6_0.1.x86_64
- candlepin-0.9.19-1.el6_5.noarch
- candlepin-scl-1-5.el6_4.noarch
- candlepin-scl-quartz-2.1.5-5.el6_4.noarch
- candlepin-scl-rhino-1.7R3-1.el6_4.noarch
- candlepin-scl-runtime-1-5.el6_4.noarch
- candlepin-selinux-0.9.19-1.el6_5.noarch
- candlepin-tomcat6-0.9.19-1.el6_5.noarch
- elasticsearch-0.90.10-4.el6sat.noarch
- foreman-1.6.0.29-1.el6sat.noarch
- foreman-compute-1.6.0.29-1.el6sat.noarch
- foreman-gce-1.6.0.29-1.el6sat.noarch
- foreman-libvirt-1.6.0.29-1.el6sat.noarch
- foreman-ovirt-1.6.0.29-1.el6sat.noarch
- foreman-postgresql-1.6.0.29-1.el6sat.noarch
- foreman-proxy-1.6.0.21-1.el6sat.noarch
- foreman-selinux-1.6.0-8.el6sat.noarch
- foreman-vmware-1.6.0.29-1.el6sat.noarch
- katello-1.5.0-27.el6sat.noarch
- katello-ca-1.0-1.noarch
- katello-certs-tools-1.5.6-1.el6sat.noarch
- katello-installer-0.0.56-1.el6sat.noarch
- openldap-2.4.23-32.el6_4.1.x86_64
- pulp-katello-0.3-3.el6sat.noarch
- pulp-nodes-common-2.4.0-0.23.beta.el6sat.noarch
- pulp-nodes-parent-2.4.0-0.23.beta.el6sat.noarch
- pulp-puppet-plugins-2.4.0-0.23.beta.el6sat.noarch
- pulp-puppet-tools-2.4.0-0.23.beta.el6sat.noarch
- pulp-rpm-plugins-2.4.0-0.23.beta.el6sat.noarch
- pulp-selinux-2.4.0-0.23.beta.el6sat.noarch
- pulp-server-2.4.0-0.23.beta.el6sat.noarch
- python-ldap-2.3.10-1.el6.x86_64
- ruby193-rubygem-net-ldap-0.3.1-3.el6sat.noarch
- ruby193-rubygem-runcible-1.1.0-2.el6sat.noarch
- rubygem-hammer_cli-0.1.1-10.el6sat.noarch
- rubygem-hammer_cli_foreman-0.1.1-12.el6sat.noarch
- rubygem-hammer_cli_foreman_tasks-0.0.3-3.el6sat.noarch
- rubygem-hammer_cli_katello-0.0.4-8.el6sat.noarch
How reproducible:
Steps to Reproduce:
1. Create a new hostgroup using the following name and save it: 쥄㣆ꢕ䗀ᖑᆰ뒘礋捖䱣쒀䴮쏩騬橌矄ⱅರ㪷澘쨼
2. Try to edit it via UI
3.
Actual results:
You'll get a Host Group Not Found page (see screenshot)
Expected results:
Additional info:
Related issues
Associated revisions
History
#1
Updated by Dominic Cleal almost 9 years ago
- Category set to Web Interface
The host group name causes #to_param to return "22-" (the ID and a hyphen) as the name parameterises to an empty string (due to the UTF-8). The bug appears to be in find_by_name in application_controller, which isn't parsing "22-" correctly and looking it up by ID only.
#2
Updated by Dominic Cleal almost 9 years ago
Same issue if you create a template with the name " "
(https://bugzilla.redhat.com/show_bug.cgi?id=1121516).
#3
Updated by Dominic Cleal almost 9 years ago
And naturally, every other resource type.
- compute resources (https://bugzilla.redhat.com/show_bug.cgi?id=1123352)
- archs (https://bugzilla.redhat.com/show_bug.cgi?id=1123388)
#4
Updated by Ohad Levy almost 9 years ago
Dominic Cleal wrote:
And naturally, every other resource type.
- compute resources (https://bugzilla.redhat.com/show_bug.cgi?id=1123352)
- archs (https://bugzilla.redhat.com/show_bug.cgi?id=1123388)
I'm wondering if we should allow non UTF8 chars in general, for sure it doesnt make sense for archs.
@Dominic, do you happen to know if puppet handles UTF8 correctly? e.g. if the ENC output will contain a hostgroup / compute resource etc in utf8?
#5
Updated by Dominic Cleal almost 9 years ago
I'm not sure, we've had some Unicode ENC issues in the past as Ruby encodes the YAML in a bizarre manner, however not supporting Unicode will probably cause more problems unless it's unavoidable.
#6
Updated by Dominic Cleal almost 9 years ago
- Target version set to 1.7.5
#7
Updated by Tomáš Strachota almost 9 years ago
- Status changed from New to Assigned
- Assignee set to Tomáš Strachota
#8
Updated by The Foreman Bot almost 9 years ago
- Status changed from Assigned to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/1685 added
- Pull request deleted (
)
#9
Updated by Anonymous almost 9 years ago
- Target version changed from 1.7.5 to 1.7.4
#10
Updated by Anonymous over 8 years ago
- Target version changed from 1.7.4 to 1.7.3
#11
Updated by Dominic Cleal over 8 years ago
- Target version changed from 1.7.3 to 1.7.2
#12
Updated by Tomáš Strachota over 8 years ago
The problem with not being able to edit unicode-named resources was fixed by
commit 8b737c9c7648b3726dadb3b2e4708fcb43af02a8 Author: Joseph Magen <jmagen@redhat.com> Date: Tue Sep 23 12:02:52 2014 +0300 fixes #4386 - gem friendly_id to simplify find by id, name, label, etc
which conflicted with my solution but was merged faser.
I updated my PR and keep it open as it still makes the url look nicer (keeps unicode characters there) and fixes links in various ui templates.
#13
Updated by Dominic Cleal over 8 years ago
- Bugzilla link changed from 1121755 to 1154187
#14
Updated by Anonymous over 8 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset e768c9761528c64fcc289c391091fcce63e82ff8.
#15
Updated by Dominic Cleal over 8 years ago
- Related to Bug #8056: "The page you were looking for doesn't exist." for smart proxy 'Refresh Features' and Editing added
#16
Updated by Dominic Cleal over 8 years ago
- Legacy Backlogs Release (now unused) set to 21
Fixes #6710 - unicode characters in url parameters
Original methods to_param defined on resources called name.parameterize
to get rid of url-unsafe characters. This function unfortunately also
stripped off unicode characters.
Changes:
- parameterization extracted into a separate module Parameterizable
- each resource defines methods 'to_param' and 'from_param' to ensure correct search
- views updated to always use to_param when building links
- parameterization changed to id+name for resources where it wasn't safe to rely only on names
- default parameter is id