Roundcube Community Forum

 

Folders starting with dot not displayed

Started by martinbocek, July 23, 2015, 07:32:49 AM

Previous topic - Next topic

martinbocek

Hello,
I have met a problem - IMAP folder names starting with dot (".") are not displayed in folder list. For example:
.folder/subfolder    !!!
folder/.subfolder    OK
.folder/.subfolder   !!!

Delimiter on our IMAP server (Cyrus) is "/", I have set this in my RC config.

I have gone thru source code, the problem seems to be in rcube_imap class - method list_folders_subscribed received correct list of folders from IMAP server, then sorts them using sort_folder_list method.

sort_folder_list silently throws away folders starting with dot (line 4184):

        // convert names to UTF-8 and skip folders starting with '.'
        foreach ($a_folders as $folder) {
            if ($folder[0] != '.') {
                // for better performance skip encoding conversion
                // if the string does not look like UTF7-IMAP
                $folders[$folder] = strpos($folder, '&') === false ? $folder : rcube_charset::convert($folder, 'UTF7-IMAP');
            }
        }

       // continues to work with $folders, $a_folders items not matching ($folder[0] != '.') are lost from list


I think this is not a correct behaviour. RC allows user to create new folders starting with dot, creates them on the IMAP server, but it does not display them later in list. If I disable the condition, all folders are displayed correctly.

Can someone write his oppinnion on this before I post a bug report?

Thank you

alec

Looks like a hack from old days where some IMAP servers were returning real hidden filesystem folders via IMAP. I think UW-IMAP may do this still. Some IMAP clients decided to hide these folders, so did Roundcube. However, IMAP RFC does not cover this and I think we could reconsider, maybe as an optional feature. For example Thunderbird does not hide such folders.

martinbocek

Thank for your reply. Config option like "disallow dot starting folder name" etc would be great. This should also affect new folder creation. I agree that it is a strange idea to use a dot as first symbol, but some of my users are using this.