Fix parsing of IMAP folder names (#4830).