import re from django import forms from django.utils.translation import gettext_lazy as _ # pool target and source paths, both put into the pool XML: letters, digits, # "/", "_", ".", ":" (/dev/disk/by-path names) and "-" not first and not right # after "/". Written without nested repetition, which backtracked # exponentially on crafted input. POOL_PATH = re.compile(r"(?!-)(?:[/0-9a-zA-Z_.:]|(? 120: raise forms.ValidationError( _("The image name must not exceed 120 characters") ) return name