summaryrefslogtreecommitdiffstats
path: root/mh.c
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2021-10-07 17:40:50 -0700
committerKevin McCarthy <kevin@8t8.us>2021-10-08 09:45:48 -0700
commit986e9e7460d373906c76cc3be3a7a515e933c258 (patch)
treee5913e2af34fb15ab4f473e40e7f055b20473333 /mh.c
parent146187175fe201fcbfc9737ae51ae0c7db653337 (diff)
Remove trailing slashes when opening maildir/mh mailboxes.
IMAP cleans this up already (and file-based mailboxes don't allow it). It's easy to have this happen by tab-completing a maildir mailbox at the change folder prompt. Removing the slash makes the display more uniform, and prevents some problems such as $trash folder comparison.
Diffstat (limited to 'mh.c')
-rw-r--r--mh.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/mh.c b/mh.c
index 1cea86ea..818dbdb5 100644
--- a/mh.c
+++ b/mh.c
@@ -1272,6 +1272,12 @@ static int mh_read_dir (CONTEXT * ctx, const char *subdir)
int count;
char msgbuf[STRING];
progress_t progress;
+ size_t pathlen;
+
+ /* Clean up the path */
+ pathlen = mutt_strlen (ctx->path);
+ while ((pathlen > 1) && ctx->path[pathlen - 1] == '/')
+ ctx->path[--pathlen] = '\0';
memset (&mhs, 0, sizeof (mhs));
if (!ctx->quiet)