From 79a79852213bebdb1a98961987683849a6b58cfe Mon Sep 17 00:00:00 2001 From: Son NK Date: Sun, 1 Dec 2019 23:41:15 +0000 Subject: [PATCH] handle the case where no hostname is provided in /api/alias/new --- app/api/views/index.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/api/views/index.py b/app/api/views/index.py index e5dd7e05..853f6552 100644 --- a/app/api/views/index.py +++ b/app/api/views/index.py @@ -54,6 +54,11 @@ def index(): if user.is_premium(): LOG.d("create new custom alias %s %s", hostname, user) + # avoid too short custom email prefix + if len(hostname) < 3: + LOG.d("hostname %s too short", hostname) + hostname = "default" + # generate a custom email found = False while not found: