diff options
Diffstat (limited to 'api')
-rw-r--r-- | api/context.go | 19 | ||||
-rw-r--r-- | api/templates/error.html | 2 | ||||
-rw-r--r-- | api/user.go | 3 |
3 files changed, 14 insertions, 10 deletions
diff --git a/api/context.go b/api/context.go index 9a276a1a1..d90fbd9ee 100644 --- a/api/context.go +++ b/api/context.go @@ -456,18 +456,19 @@ func IsPrivateIpAddress(ipAddress string) bool { } func RenderWebError(err *model.AppError, w http.ResponseWriter, r *http.Request) { + props := make(map[string]string) + props["Message"] = err.Message + props["Details"] = err.DetailedError - protocol := GetProtocol(r) - SiteURL := protocol + "://" + r.Host - - m := make(map[string]string) - m["Message"] = err.Message - m["Details"] = err.DetailedError - m["SiteName"] = utils.Cfg.TeamSettings.SiteName - m["SiteURL"] = SiteURL + pathParts := strings.Split(r.URL.Path, "/") + if len(pathParts) > 1 { + props["SiteURL"] = GetProtocol(r) + "://" + r.Host + "/" + pathParts[1] + } else { + props["SiteURL"] = GetProtocol(r) + "://" + r.Host + } w.WriteHeader(err.StatusCode) - ServerTemplates.ExecuteTemplate(w, "error.html", m) + ServerTemplates.ExecuteTemplate(w, "error.html", Page{Props: props, ClientProps: utils.ClientProperties}) } func Handle404(w http.ResponseWriter, r *http.Request) { diff --git a/api/templates/error.html b/api/templates/error.html index 760578896..6b643556e 100644 --- a/api/templates/error.html +++ b/api/templates/error.html @@ -23,7 +23,7 @@ <div class="error__container"> <div class="error__icon"><i class="fa fa-exclamation-triangle"></i></div> <h2>{{ .ClientProps.SiteName }} needs your help:</h2> - <p>{{.Message}}</p> + <p>{{ .Props.Message }}</p> <a href="{{.Props.SiteURL}}">Go back to team site</a> </div> </div> diff --git a/api/user.go b/api/user.go index bbe6efb9f..9ed4404f1 100644 --- a/api/user.go +++ b/api/user.go @@ -817,6 +817,9 @@ func uploadProfileImage(c *Context, w http.ResponseWriter, r *http.Request) { Srv.Store.User().UpdateLastPictureUpdate(c.Session.UserId) c.LogAudit("") + + // write something as the response since jQuery expects a json response + w.Write([]byte("true")) } func updateUser(c *Context, w http.ResponseWriter, r *http.Request) { |