1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-23 07:09:43 +02:00
This commit is contained in:
HarveyKandola 2018-07-28 15:30:33 -04:00
parent d0970c153b
commit f916801008
3 changed files with 176 additions and 8 deletions

View file

@ -732,6 +732,18 @@ func (h *Handler) Export(w http.ResponseWriter, r *http.Request) {
method := "document.Export"
ctx := domain.GetRequestContext(r)
// Deduce ORG if anon user.
if len(ctx.OrgID) == 0 {
ctx.Subdomain = organization.GetSubdomainFromHost(r)
org, err := h.Store.Organization.GetOrganizationByDomain(ctx.Subdomain)
if err != nil {
response.WriteServerError(w, method, err)
h.Runtime.Log.Error(method, err)
return
}
ctx.OrgID = org.RefID
}
defer streamutil.Close(r.Body)
body, err := ioutil.ReadAll(r.Body)
if err != nil {
@ -756,6 +768,6 @@ func (h *Handler) Export(w http.ResponseWriter, r *http.Request) {
}
w.Header().Set("Content-Type", "text/html; charset=utf-8")
w.Write([]byte(export))
w.WriteHeader(http.StatusOK)
w.Write([]byte(export))
}

File diff suppressed because one or more lines are too long

View file

@ -363,7 +363,7 @@ export default Service.extend({
return this.get('ajax').post('export', {
data: JSON.stringify(spec),
contentType: 'json',
dataType: 'text/html'
dataType: 'html'
});
},