summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ogcp/views.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/ogcp/views.py b/ogcp/views.py
index f964c1e..8b544eb 100644
--- a/ogcp/views.py
+++ b/ogcp/views.py
@@ -30,6 +30,7 @@ from ogcp.og_server import OGServer, servers
from flask_babel import lazy_gettext as _l
from flask_babel import gettext, _
from ogcp import app, ogcp_cfg_path
+import unicodedata
import ipaddress
import requests
import datetime
@@ -123,6 +124,10 @@ def is_valid_ip(ip):
return False
return True
+def remove_accents(text):
+ normalized_text = unicodedata.normalize('NFD', text)
+ return ''.join(c for c in normalized_text if unicodedata.category(c) != 'Mn')
+
def ogserver_down(view):
flash(_('Cannot talk to ogserver. Is ogserver down?'), category='error')
return redirect(url_for(view))
@@ -2380,7 +2385,7 @@ def action_image_create():
if r.status_code != requests.codes.ok:
return ogserver_error('commands')
- image_name = form.name.data.strip()
+ image_name = remove_accents(form.name.data.strip())
if ' ' in image_name:
flash(_('No spaces allowed in image names'), category='error')
return redirect(url_for('commands'))