Ticket #1484803 (closed Bugs: fixed)

Opened 8 months ago

Last modified 5 months ago

can't creat a foldername containing a period

Reported by: brunke Owned by: till
Priority: 3 Milestone: 0.2-alpha
Component: Client Scripts Version: 0.1-rc2
Severity: normal Keywords: folder period
Cc:

Description

If I try to create a folder named something like: "xxx.yyy", the saved name will become: " yyy"

Attachments

periodtest.jpg (44.4 kB) - added by lancey 8 months ago.
Creating a folder with a period in it's name

Change History

Changed 8 months ago by lancey

Creating a folder with a period in it's name

  Changed 8 months ago by lancey

This is totally dependent on the IMAP server used. I'm attaching an image showing RC processes this fine.

Also, please try latest SVN trunk.

  Changed 8 months ago by lancey

I have (almost) duplicated this bug, but using Courier IMAP. Courier handles "." as a subfolder divider, thus creating a Period.Test folder really means to Courier - create a Period folder, with a subfolder named "Test".

Rouncube's only fault is that, right after creation, it does display the folder named "Test" only, indented as it is a subfolder, but doesn't show the "Period" root folder also created by the request. Switching to the mailbox, it's displayed fine. Switching back to settings, it's now fine - correctly displaying folders.

We basically need to check, right after folder creating, what has the IMAP server done (probably resyncronize the whole folder list).

  Changed 8 months ago by seansan

  • milestone set to 0.1.1

Review in 0.1.1

follow-up: ↓ 5   Changed 7 months ago by till

No, I think the error is that "." is not escaped. ;-) It should be possible to create folder with a dot. For whatever reason. :)

in reply to: ↑ 4   Changed 7 months ago by the_glu

Replying to till:

No, I think the error is that "." is not escaped. ;-) It should be possible to create folder with a dot. For whatever reason. :)

It's doesn't seem to be possible to make one with thunderbird. At the creation, a sub folder is created and if you try to rename the folder with a dot, thunderbird say it's a reserved character. (Rc show an error when renaming).

So here is a patch to create parent folder of a subfolder if he dosen't already exist.

Index: program/js/app.js
===================================================================
--- program/js/app.js	(révision 1216)
+++ program/js/app.js	(copie de travail)
@@ -2695,7 +2695,7 @@
 
 
   // add a new folder to the subscription list by cloning a folder row
-  this.add_folder_row = function(name, display_name, replace)
+  this.add_folder_row = function(name, display_name, replace, checkexist)
     {
     name = name.replace('\\',"");
     if (!this.gui_objects.subscriptionlist)
@@ -2705,6 +2705,11 @@
       if (this.env.subscriptionrows[refid]!=null)
         break;
 
+     if (checkexist)
+        for (var rowlist in this.env.subscriptionrows)
+            if (this.env.subscriptionrows[rowlist][0] == name && this.env.subscriptionrows[rowlist][1] == display_name)
+                return false;
+
     var refrow, form;
     var tbody = this.gui_objects.subscriptionlist.tBodies[0];
     var id = 'rcmrow'+(tbody.childNodes.length+1);
@@ -3785,4 +3790,3 @@
   if (window[o] && window[o].init)
     setTimeout(o+'.init()', 200);
   }
-
Index: program/steps/settings/manage_folders.inc
===================================================================
--- program/steps/settings/manage_folders.inc	(révision 1216)
+++ program/steps/settings/manage_folders.inc	(copie de travail)
@@ -55,8 +55,19 @@
     {
     $delimiter = $IMAP->get_hierarchy_delimiter();
     $foldersplit = explode($delimiter, $create);
-    $display_create = str_repeat('    ', substr_count($create, $delimiter)) . rcube_charset_convert($foldersplit[count($foldersplit)-1], 'UTF-7');
-    $OUTPUT->command('add_folder_row', $create, $display_create);
+
+    foreach ($foldersplit as $level => $foldername) {
+        $display_create = str_repeat('    ', $level) . rcube_charset_convert($foldername, 'UTF-7');
+
+        if (!isset($folderlevel))
+            $folderlevel = $foldername;
+        else
+            $folderlevel .= $delimiter.$foldername;
+
+        $OUTPUT->command('add_folder_row', $folderlevel, $display_create, false, true);
+    }
+
+
     $OUTPUT->send();
     }
   else if (!$create && $OUTPUT->ajax_call)

  Changed 7 months ago by till

  • owner set to till
  • status changed from new to assigned

  Changed 6 months ago by alec

the_glu's patch it's only beginning. In my environment, when creating folder with delimiter in its name, IMAP server is creating one folder on the disk.

So, by example: for folder 'Test.Sub' (after creation) we should check if folder 'Test' exists first, if not we should add row with 'Test' folder but marked as non-existent (without subscription or name change options). Finally add normal 'Sub' row below the 'Test'. Such approach causes also changes in folder delete, rename actions and when building folders list, but it's implemented in Thunderbird and I think it's good.

Other way is to create folder 'Test' behind the scene and then show him as in the_glu's fix. It would be simplier, but I think it wouldn't be wanted behavior.

  Changed 5 months ago by alec

  • status changed from assigned to closed
  • resolution set to fixed

In r1455 folder name cannot contains delimiter on create or rename, so problem solved for now.

Note: See TracTickets for help on using tickets.