[evolution-data-server] I#389 - IMAPx: Fails to create folder with NIL folder hierarchy delimiter



commit 85bdd943337c02557b41c4b19800fbc5c91d9ed0
Author: Milan Crha <mcrha redhat com>
Date:   Tue May 10 14:00:14 2022 +0200

    I#389 - IMAPx: Fails to create folder with NIL folder hierarchy delimiter
    
    Closes https://gitlab.gnome.org/GNOME/evolution-data-server/-/issues/389

 src/camel/providers/imapx/camel-imapx-store.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/src/camel/providers/imapx/camel-imapx-store.c b/src/camel/providers/imapx/camel-imapx-store.c
index 140f35745..c1c7dce6f 100644
--- a/src/camel/providers/imapx/camel-imapx-store.c
+++ b/src/camel/providers/imapx/camel-imapx-store.c
@@ -2317,6 +2317,17 @@ imapx_store_create_folder_sync (CamelStore *store,
                goto exit;
 
        separator = camel_imapx_mailbox_get_separator (parent_mailbox);
+
+       /* NIL separator means flat structure, where subfolders cannot be created */
+       if (!separator) {
+               g_set_error_literal (
+                       error, CAMEL_FOLDER_ERROR,
+                       CAMEL_FOLDER_ERROR_INVALID_PATH,
+                       _("The account does not support folder hierarchy. Create the folder on the account 
level instead."));
+               g_object_unref (parent_mailbox);
+               goto exit;
+       }
+
        parent_mailbox_name = camel_imapx_mailbox_get_name (parent_mailbox);
 
        mailbox_name = g_strdup_printf (
@@ -2355,7 +2366,7 @@ check_namespace:
 
 check_separator:
 
-       if (strchr (folder_name, separator) != NULL) {
+       if (separator && strchr (folder_name, separator) != NULL) {
                g_set_error (
                        error, CAMEL_FOLDER_ERROR,
                        CAMEL_FOLDER_ERROR_INVALID_PATH,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]