diff --git a/instances/views.py b/instances/views.py index 028891c..d0f4dc1 100644 --- a/instances/views.py +++ b/instances/views.py @@ -3,6 +3,7 @@ import time import json import socket import crypt +import re from string import letters, digits from random import choice from bisect import insort @@ -610,6 +611,9 @@ def instance(request, compute_id, vname): elif check_instance: msg = _("Instance '%s' already exists!" % clone_data['name']) error_messages.append(msg) + elif not re.match(r'^[a-zA-Z0-9-]+$', clone_data['name']): + msg = _("Instance name '%s' contains invalid characters!" % clone_data['name']) + error_messages.append(msg) else: for post in request.POST: clone_data[post] = request.POST.get(post, '')