]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: List index rebuild - Don't try to restore INBOX as INBOX/INBOX
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 27 Jan 2026 08:36:31 +0000 (10:36 +0200)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 7 May 2026 20:22:22 +0000 (20:22 +0000)
This happened to work for now, but not after the following changes.

src/lib-storage/list/mail-storage-list-index-rebuild.c

index d7b487d39047fc8303863ead7f65a03d67d686ed..d7135654a988a2599b76d7a41d3531df95f62e64 100644 (file)
@@ -140,12 +140,8 @@ static const char *get_box_name(struct mail_storage_list_index_rebuild_ctx *ctx,
                                mailbox_list_get_root_forced(box->list, MAILBOX_LIST_PATH_TYPE_MAILBOX),
                                guid_128_to_string(box->guid));
        const char *box_name;
-       bool inbox_ns = (box->list->ns->flags & NAMESPACE_FLAG_INBOX_USER) != 0;
 
        if (try_get_mailbox_name(ctx, box->list, path, &box_name)) {
-               /* special case handling */
-               if (inbox_ns && strcmp(box_name, "INBOX") == 0)
-                       box_name = "INBOX";
                e_debug(ctx->storage->event, "Found '%s' from storage %s",
                        box_name, path);
        } else {
@@ -456,8 +452,15 @@ static int mail_storage_list_index_add_missing(struct mail_storage_list_index_re
                const char *name = box->index_name;
                if (name == NULL)
                        name = get_box_name(ctx, box);
-               const char *orig_vname =
-                       t_strconcat(box->list->ns->prefix, name, NULL);
+
+               /* Differentiate between INBOX and <ns prefix>/INBOX */
+               const char *orig_vname;
+               if ((box->list->ns->flags & NAMESPACE_FLAG_INBOX_USER) != 0 &&
+                   strcmp(name, "INBOX") == 0)
+                       orig_vname = "INBOX";
+               else
+                       orig_vname = t_strconcat(box->list->ns->prefix, name, NULL);
+
                const char *vname = orig_vname;
                for (unsigned int i = 0; ; i++) {
                        _node = mailbox_tree_get(tree, vname, &created);