Merge "Only allow http/https schemas for image download"

This commit is contained in:
Jenkins 2015-09-12 15:53:24 +00:00 committed by Gerrit Code Review
commit fc64d3b191

View File

@ -19,7 +19,9 @@
""" """
Views for managing images. Views for managing images.
""" """
from django.conf import settings from django.conf import settings
from django.core import validators
from django.forms import ValidationError # noqa from django.forms import ValidationError # noqa
from django.forms.widgets import HiddenInput # noqa from django.forms.widgets import HiddenInput # noqa
from django.template import defaultfilters from django.template import defaultfilters
@ -102,6 +104,8 @@ class CreateImageForm(forms.SelfHandlingForm):
'ng-model': 'copyFrom', 'ng-model': 'copyFrom',
'ng-change': 'ng-change':
'ctrl.selectImageFormat(copyFrom)'}), 'ctrl.selectImageFormat(copyFrom)'}),
validators=[validators.URLValidator(
schemes=["http", "https"])],
required=False) required=False)
image_file = forms.FileField(label=_("Image File"), image_file = forms.FileField(label=_("Image File"),
help_text=_("A local image to upload."), help_text=_("A local image to upload."),