X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=imap%2Futil.c;h=5062786b3c51b2e25d6b9f35d1a1f09f1f35867e;hp=6f435593f4db20aafaf2ab665cbbeae0a1e0aa70;hb=b1dfcb5c755ef8c2be60369432bc91e434b72a1f;hpb=3d937534e7b1ee723f86594b5e4c64c95158a933 diff --git a/imap/util.c b/imap/util.c index 6f43559..5062786 100644 --- a/imap/util.c +++ b/imap/util.c @@ -20,6 +20,8 @@ /* general IMAP utility functions */ +#include "config.h" + #include "mutt.h" #include "mx.h" /* for M_IMAP */ #include "url.h" @@ -269,6 +271,7 @@ void imap_free_idata (IMAP_DATA** idata) { * in IMAP. Additionally, the filesystem converts multiple hierarchy * delimiters into a single one, ie "///" is equal to "/". IMAP servers * are not required to do this. + * Moreover, IMAP servers may dislike the path ending with the delimiter. */ char *imap_fix_path (IMAP_DATA *idata, char *mailbox, char *path, size_t plen) @@ -295,6 +298,8 @@ char *imap_fix_path (IMAP_DATA *idata, char *mailbox, char *path, } x++; } + if (x && path[--x] != idata->delim) + x++; path[x] = '\0'; return path; }