make sure a custom domain name does not contain a linebreak

This commit is contained in:
Son NK 2020-11-20 18:40:07 +01:00
parent 78ddf16c87
commit 8aed5ced3f
2 changed files with 5 additions and 1 deletions

View file

@ -154,7 +154,7 @@ def domain_detail(custom_domain_id):
url_for("dashboard.domain_detail", custom_domain_id=custom_domain.id)
)
elif request.form.get("form-name") == "set-name":
custom_domain.name = request.form.get("alias-name")
custom_domain.name = request.form.get("alias-name").replace("\n", "")
db.session.commit()
flash(
f"Default alias name for Domain {custom_domain.domain} has been set",

View file

@ -395,6 +395,10 @@ def sanity_check():
if not contact.reply_email.isascii():
LOG.exception("Contact %s reply email is not ascii", contact)
for domain in CustomDomain.query.all():
if domain.name and "\n" in domain.name:
LOG.exception("Domain %s name contain linebreak %s", domain, domain.name)
LOG.d("Finish sanity check")