Make Image Description an input field instead of a textarea

The glanceclient passes the value of the "Description" field as
HTTP headers to the API, completely unmodified.  If there are
newlines in the content, it corrupts the headers and creates havoc.

Encoding/decoding the results is not viable, since arbitrary (and
not necessarily controlled by anyone) clients can retrieve the data.  So as
a dodge, use a normal <input> field for Description instead of
<textarea> field, as newlines are not permitted in the former.

Closes-Bug: 1370732
Change-Id: I0231eaa693e7f36699fda6e011db8c976b639411
This commit is contained in:
Nicolas Simonds 2014-09-17 14:49:08 -07:00
parent 57de1d2a60
commit 363ccf7b39
1 changed files with 4 additions and 9 deletions

View File

@ -38,10 +38,8 @@ IMAGE_FORMAT_CHOICES = IMAGE_BACKEND_SETTINGS.get('image_formats', [])
class CreateImageForm(forms.SelfHandlingForm):
name = forms.CharField(max_length=255, label=_("Name"))
description = forms.CharField(widget=forms.widgets.Textarea(
attrs={'class': 'modal-body-fixed-width', 'rows': 4}),
label=_("Description"),
required=False)
description = forms.CharField(max_length=255, label=_("Description"),
required=False)
source_type = forms.ChoiceField(
label=_('Image Source'),
@ -193,11 +191,8 @@ class CreateImageForm(forms.SelfHandlingForm):
class UpdateImageForm(forms.SelfHandlingForm):
image_id = forms.CharField(widget=forms.HiddenInput())
name = forms.CharField(max_length=255, label=_("Name"))
description = forms.CharField(
widget=forms.widgets.Textarea(),
label=_("Description"),
required=False,
)
description = forms.CharField(max_length=255, label=_("Description"),
required=False)
kernel = forms.CharField(
max_length=36,
label=_("Kernel ID"),