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



commit 3a6f513663534154d53223f00561f37386264041
Author: Milan Crha <mcrha redhat com>
Date:   Tue May 10 14:05:13 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 | 12 +++++++++++-
 1 file changed, 11 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..c5d1f819f 100644
--- a/src/camel/providers/imapx/camel-imapx-store.c
+++ b/src/camel/providers/imapx/camel-imapx-store.c
@@ -2317,6 +2317,16 @@ 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_object_unref (parent_mailbox);
+               /* Cannot set error here, like in the development version, due to untranslated
+                  string, thus let it create the folder in the top level. Evolution throws
+                  an error about "folder not found" due to using the path with the parent folder. */
+               goto check_namespace;
+       }
+
        parent_mailbox_name = camel_imapx_mailbox_get_name (parent_mailbox);
 
        mailbox_name = g_strdup_printf (
@@ -2355,7 +2365,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]