mirror of
https://github.com/documize/community.git
synced 2025-07-27 17:19:42 +02:00
Logo fetching to match on domain mismatch
Fixes #209 Sometimes people use subdomain like docs.example.org but backend does not reflect the domain, e.g. dmz_org.c_domain is empty. So we fall back to loading logo for empty c_domain value as well.
This commit is contained in:
parent
d4f6694933
commit
66003dac21
1 changed files with 9 additions and 1 deletions
|
@ -310,12 +310,20 @@ func (h *Handler) Logo(w http.ResponseWriter, r *http.Request) {
|
||||||
ctx := domain.GetRequestContext(r)
|
ctx := domain.GetRequestContext(r)
|
||||||
d := organization.GetSubdomainFromHost(r)
|
d := organization.GetSubdomainFromHost(r)
|
||||||
|
|
||||||
// If organization has logo, send it back.
|
// If organization has logo, send it back by using specified subdomain.
|
||||||
logo, err := h.Store.Organization.Logo(ctx, d)
|
logo, err := h.Store.Organization.Logo(ctx, d)
|
||||||
if err == nil && len(logo) > 0 {
|
if err == nil && len(logo) > 0 {
|
||||||
h.writeLogo(w, r, logo)
|
h.writeLogo(w, r, logo)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sometimes people use subdomain like docs.example.org but backend
|
||||||
|
// does not reflect that domain, e.g. dmz_org.c_domain is empty.
|
||||||
|
logo, err = h.Store.Organization.Logo(ctx, "")
|
||||||
|
if err == nil && len(logo) > 0 {
|
||||||
|
h.writeLogo(w, r, logo)
|
||||||
|
return
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
h.Runtime.Log.Infof("unable to fetch logo for domain %s", d)
|
h.Runtime.Log.Infof("unable to fetch logo for domain %s", d)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue