diff options
author | Jack <jackdeng@gmail.com> | 2015-09-28 08:14:57 -0700 |
---|---|---|
committer | Jack <jackdeng@gmail.com> | 2015-09-28 08:14:57 -0700 |
commit | 503501ab3b616fb9fa57b046df850cfc2db734f8 (patch) | |
tree | 43e529250bab982c73816f1ffdf673e8e4b98c13 /api/context.go | |
parent | aa6da728baf2f5642293d8b56ebc1ff4e8682bce (diff) | |
parent | a055fd10b83b28bf97877e4e28a2275f74a71a4a (diff) | |
download | chat-503501ab3b616fb9fa57b046df850cfc2db734f8.tar.gz chat-503501ab3b616fb9fa57b046df850cfc2db734f8.tar.bz2 chat-503501ab3b616fb9fa57b046df850cfc2db734f8.zip |
rebase
Diffstat (limited to 'api/context.go')
-rw-r--r-- | api/context.go | 19 |
1 files changed, 10 insertions, 9 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) { |