From 1c54bb3a9d11185d86745c64f2c28655385c9146 Mon Sep 17 00:00:00 2001 From: Robin Jarry Date: Sun, 29 Sep 2024 21:19:52 +0200 Subject: models: pad message uids with zeroes IMAP message UIDs are 32 bits unsigned integers. All other backends use opaque strings without any specific ordering. The UIDs are used for ordering only for IMAP. Pad the integer uids with zeroes when converting them to strings to ensure ASCII sorting will work as previously. Fixes: 73dc39c6ee08 ("treewide: replace uint32 uids with opaque strings") Reported-by: Fedor Pchelkin Signed-off-by: Robin Jarry Tested-by: Jens Grassel --- models/models.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'models') diff --git a/models/models.go b/models/models.go index 0f7c8445..4803c9b8 100644 --- a/models/models.go +++ b/models/models.go @@ -116,7 +116,7 @@ func UidToUint32(uid UID) uint32 { } func Uint32ToUid(u uint32) UID { - return UID(strconv.FormatUint(uint64(u), 10)) + return UID(fmt.Sprintf("%012d", u)) } func UidToUint32List(uids []UID) []uint32 { -- cgit