From edb6e8d15c36ec409b10f4a96618559658f71ce3 Mon Sep 17 00:00:00 2001 From: Mechiel Lukkien Date: Fri, 4 Oct 2024 16:37:32 +0200 Subject: [PATCH] webmail: fix displaying a message in separate window if there was no known viewmode (text or html or html with externals) we were sending a zero value for ViewMode, which the frontend js rejected during parsing. noticed during testing. --- webmail/api.go | 4 +++- webmail/message.go | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/webmail/api.go b/webmail/api.go index 9d07f62637..21e490daa0 100644 --- a/webmail/api.go +++ b/webmail/api.go @@ -204,8 +204,10 @@ func fromAddrViewMode(tx *bstore.Tx, from MessageAddress) (store.ViewMode, error err = tx.Get(&fas) if err == bstore.ErrAbsent { return settingsViewMode() + } else if err != nil { + return store.ModeText, err } - return fas.ViewMode, err + return fas.ViewMode, nil } // FromAddressSettingsSave saves per-"From"-address settings. diff --git a/webmail/message.go b/webmail/message.go index 53f65ae1a4..9237624c77 100644 --- a/webmail/message.go +++ b/webmail/message.go @@ -181,6 +181,8 @@ func formatFirstLine(r io.Reader) (string, error) { } func parsedMessage(log mlog.Log, m store.Message, state *msgState, full, msgitem bool) (pm ParsedMessage, rerr error) { + pm.ViewMode = store.ModeText // Valid default, in case this makes it to frontend. + if full || msgitem { if !state.ensurePart(m, true) { return pm, state.err