diff --git a/ipynbsrv/core/models.py b/ipynbsrv/core/models.py index 7d48146..bd959b3 100644 --- a/ipynbsrv/core/models.py +++ b/ipynbsrv/core/models.py @@ -772,7 +772,15 @@ class ContainerImage(models.Model): max_length=255, help_text='The primary key the backend uses to identify this image.' ) - name = models.CharField(max_length=75) + name = models.CharField( + max_length=75, + validators=[ + RegexValidator( + regex='^[A-z][\w\/]*$', + message='Invalid container snapshot name.' + ) + ] + ) description = models.TextField(blank=True, null=True) # TODO: document placeholders command = models.CharField( diff --git a/ipynbsrv/web/templates/web/container_snapshots/modal_create.html b/ipynbsrv/web/templates/web/container_snapshots/modal_create.html index d4ada7c..b87aa5e 100644 --- a/ipynbsrv/web/templates/web/container_snapshots/modal_create.html +++ b/ipynbsrv/web/templates/web/container_snapshots/modal_create.html @@ -14,6 +14,7 @@
Allowed pattern: ^[A-z]\w*$
Allowed pattern: ^[A-z][\w\/]*$
Allowed pattern: ^[A-z]\w*$