Merge "Make sure to treat extra slashes on pseudo-folder name"

This commit is contained in:
Jenkins 2015-07-24 20:12:02 +00:00 committed by Gerrit Code Review
commit ee65b21940

View File

@ -34,6 +34,11 @@ no_slash_validator = validators.RegexValidator(r'^(?u)[^/]+$',
_("Slash is not an allowed "
"character."),
code="noslash")
no_begin_or_end_slash = validators.RegexValidator(r'^[^\/](?u).+[^\/]$',
_("Slash is not allowed at "
"the beginning or end of "
"your string."),
code="nobeginorendslash")
class CreateContainer(forms.SelfHandlingForm):
@ -158,7 +163,8 @@ class CreatePseudoFolder(forms.SelfHandlingForm):
required=False,
widget=forms.HiddenInput)
name = forms.CharField(max_length=255,
label=_("Pseudo-folder Name"))
label=_("Pseudo-folder Name"),
validators=[no_begin_or_end_slash])
container_name = forms.CharField(widget=forms.HiddenInput())
def _set_pseudo_folder_path(self, data):