fix domain can be null in self-hosting
# Conflicts: # app/api/views/new_custom_alias.py # app/dashboard/views/custom_alias.py
This commit is contained in:
parent
4906d3a4a8
commit
1a22d0cf9b
|
@ -85,6 +85,7 @@ def new_custom_alias():
|
||||||
if alias_suffix.startswith("@"):
|
if alias_suffix.startswith("@"):
|
||||||
alias_domain = alias_suffix[1:]
|
alias_domain = alias_suffix[1:]
|
||||||
domain = CustomDomain.get_by(domain=alias_domain)
|
domain = CustomDomain.get_by(domain=alias_domain)
|
||||||
|
if domain:
|
||||||
LOG.d("set alias %s to domain %s", full_alias, domain)
|
LOG.d("set alias %s to domain %s", full_alias, domain)
|
||||||
alias.custom_domain_id = domain.id
|
alias.custom_domain_id = domain.id
|
||||||
|
|
||||||
|
|
|
@ -130,6 +130,7 @@ def custom_alias():
|
||||||
)
|
)
|
||||||
return redirect(url_for("dashboard.custom_alias"))
|
return redirect(url_for("dashboard.custom_alias"))
|
||||||
|
|
||||||
|
if domain:
|
||||||
custom_domain_id = domain.id
|
custom_domain_id = domain.id
|
||||||
|
|
||||||
alias = Alias.create(
|
alias = Alias.create(
|
||||||
|
|
|
@ -192,6 +192,7 @@ def authorize():
|
||||||
if alias_suffix.startswith("@"):
|
if alias_suffix.startswith("@"):
|
||||||
alias_domain = alias_suffix[1:]
|
alias_domain = alias_suffix[1:]
|
||||||
domain = CustomDomain.get_by(domain=alias_domain)
|
domain = CustomDomain.get_by(domain=alias_domain)
|
||||||
|
if domain:
|
||||||
alias.custom_domain_id = domain.id
|
alias.custom_domain_id = domain.id
|
||||||
|
|
||||||
db.session.flush()
|
db.session.flush()
|
||||||
|
|
Loading…
Reference in a new issue