imapserver: return all the extensible fields for bodystructure, notably for content-disposition

The gmail iOS/Android app were showing mime image parts as (garbled) text
instead of rendering them as image. By returning all the optional fields in the
bodystructure fetch attribute, the gmail app renders the image as expected by
the user. So we now add all fields. We didn't before, because we weren't
keeping track of Content-MD5, Content-Language and Content-Location header
fields, since they aren't that useful.

Messages in mailboxes have to be reparsed:
	./mox reparse

Without reparsing, imap responses will claim the extra fields
(content-disposition) are absent for existing messages, instead of not claiming
anything at all, which is what we did before.

Accounts and all/some mailboxes can get their "uid validity" bumped ("./mox
bumpuidvalidity $account [$mailbox]"), which should trigger clients to load all
messages from scratch, but gmail doesn't appear to notice, so it would be
better to remove & add the account in gmail.

For issue #327, also relevant to issue #217.
This commit is contained in:
Mechiel Lukkien
2025-04-05 15:46:17 +02:00
parent 69d2699961
commit 2defbce0bc
11 changed files with 185 additions and 65 deletions

View File

@ -573,9 +573,9 @@ type Message struct {
// want to strip whitespace.
Preview *string
// ParsedBuf message structure. Currently saved as JSON of message.Part because bstore
// cannot yet store recursive types. Created when first needed, and saved in the
// database.
// ParsedBuf message structure. Currently saved as JSON of message.Part because
// bstore wasn't able to store recursive types when this was implemented. Created
// when first needed, and saved in the database.
// todo: once replaced with non-json storage, remove date fixup in ../message/part.go.
ParsedBuf []byte
}