Skip to content

Commit

Permalink
SMTP GUI: Setting utf-8 charset
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Hinderberger committed Jul 5, 2024
1 parent b9e9185 commit 51fd6d0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/smtp/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func (h *smtpHTTPHandler) handleContentBody(w http.ResponseWriter, r *http.Reque
}

func (h *smtpHTTPHandler) handleGUIIndex(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/html")
w.Header().Set("Content-Type", "text/html; charset=utf-8")

err := guiIndexTemplate.Execute(w, map[string]any{"prefix": h.prefix})
if err != nil {
Expand All @@ -219,8 +219,6 @@ func (h *smtpHTTPHandler) handleGUIIndex(w http.ResponseWriter, r *http.Request)
}

func (h *smtpHTTPHandler) handleGUIMessage(w http.ResponseWriter, r *http.Request, msg *ReceivedMessage) {
w.Header().Set("Content-Type", "text/html")

metadata := buildMessageFullMeta(msg)
metadataJson, err := json.MarshalIndent(metadata, "", " ")
if err != nil {
Expand All @@ -231,6 +229,8 @@ func (h *smtpHTTPHandler) handleGUIMessage(w http.ResponseWriter, r *http.Reques
return
}

w.Header().Set("Content-Type", "text/html; charset=utf-8")

err = guiMessageTemplate.Execute(w, map[string]any{
"prefix": h.prefix,
"metadata": metadata,
Expand Down

0 comments on commit 51fd6d0

Please sign in to comment.