bad request when creating a swift container with % in name

Bug #1231904 reported by Dafna Ron
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Medium
Romain Hardouin

Bug Description

when we try to create a container that has % in its name we get a bad request page from horizon:

Bad Request

Your browser sent a request that this server could not understand.
Apache/2.2.15 (Red Hat) Server at nott-vdsa.qa.lab.tlv.redhat.com Port 80

to reproduce:

create a container with such as b%b or something of the sort.

btw, if you create a longer name of container with lots of special charterers and % is in one of them, the container will probably be created but you cannot upload/delete or list the objects in it as described in:
https://bugs.launchpad.net/horizon/+bug/1042682

so I am not sure if this bug is a duplicate or extension of the above bug but since it causes horizon to crash and the old one was closed for lack of activity I thought a new one might be in order.

I am working with package python-django-horizon-2013.2-0.12b3.el6ost.noarch

Changed in horizon:
importance: Undecided → Medium
milestone: none → icehouse-1
status: New → Triaged
Changed in horizon:
assignee: nobody → Romain Hardouin (romain-hardouin)
Revision history for this message
Romain Hardouin (romain-hardouin) wrote :

Dafna you're right, the bug #1042682 still exists. I'll also fix it with this patch since I'll fix all "%" issues.
FYI, it's due to URL that are not "urlquote()d".
Actually this is an old (4 years) Django bug since reverse() should urlquote parameters.
Django 1.6 will fix it:

https://code.djangoproject.com/ticket/13260

https://github.com/aaugustin/django/commit/01bafc5f5e5024b17ed2d725fb12d09c9885595b#diff-f83d2617ed57b0c7608c5f5581fa6e7dL377

Changed in horizon:
status: Triaged → In Progress
Revision history for this message
Romain Hardouin (romain-hardouin) wrote :

The corollary to this is we will have to remove all urlquote when Horizon will use Django 1.6

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.openstack.org/55702

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/55702
Committed: http://github.com/openstack/horizon/commit/5a57c1ee70418b81549bcf5407d6c5505d804f46
Submitter: Jenkins
Branch: master

commit 5a57c1ee70418b81549bcf5407d6c5505d804f46
Author: Romain Hardouin <email address hidden>
Date: Fri Nov 8 22:58:07 2013 +0100

    Handle '%' in Swift container names.

    When a Swift container name contains '%', it breaks many URL
    leading to "HTTP 400 Bad request" under Apache.
    (Not reproducible with Django development server)

    It is due to a Django bug in django.core.urlresolvers.reverse():
    "urlresolvers.reverse() generates invalid URLs when an argument contains % character"
    https://code.djangoproject.com/ticket/13260
    This bug have been fixed in Django 1.6.

    In the meanwhile, this patch handles '%' in URL thanks to
    django.utils.http.urlquote()

    Unit tests have been updated accordingly and
    helper functions are now tested.

    Change-Id: Ifbe781f66458df0bd013dc935f55ad0ac2c5ac61
    Closes-Bug: #1231904

Changed in horizon:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in horizon:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in horizon:
milestone: icehouse-1 → 2014.1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.