1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-24 15:49:44 +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:
Harvey Kandola 2019-02-26 11:55:08 +00:00
parent d4f6694933
commit 66003dac21

View file

@ -310,12 +310,20 @@ func (h *Handler) Logo(w http.ResponseWriter, r *http.Request) {
ctx := domain.GetRequestContext(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)
if err == nil && len(logo) > 0 {
h.writeLogo(w, r, logo)
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 {
h.Runtime.Log.Infof("unable to fetch logo for domain %s", d)
}