Skip Menu |

This queue is for tickets about the Mail-IMAPClient CPAN distribution.

Report information
The Basics
Id: 43445
Status: resolved
Priority: 0/
Queue: Mail-IMAPClient

People
Owner: Nobody in particular
Requestors: phil [...] perkpartners.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: folders() not properly handling names containing escaped quotes
Date: Thu, 19 Feb 2009 13:55:10 -0500
To: bug-Mail-IMAPClient [...] rt.cpan.org
From: Phil Lobbes <phil [...] perkpartners.com>
The folders() method sees to not properly handle names containing escaped quotes. For example, given a folder name like: Mr. "A" Which may be escaped by the server like: "Mr. \"A\"" The folders() method will return the folder name as: "Mr. \"A\"" Instead of the expected original/actual name: Mr. "A" This patch to Mail::IMAPClient 3.14 attempts to now do the right thing and pick up the entire folder name and unescape any escaped characters using the Unescape() method. Phil PS. Unescape() has some interesting "unescapings": s/\\([\\\(\)"\r\n])/$1/g; Per RFC3501 (http://tools.ietf.org/html/rfc3501#section-9) I expect backslash (\) and double quote (") and I suppose the extra parenthesis don't hurt much but the \r and \n seem are definitely not something I would expect to see in there. $ diff -u IMAPClient.pm.ORIG IMAPClient.pm --- IMAPClient.pm.ORIG 2009-02-16 08:15:52.000000000 -0500 +++ IMAPClient.pm 2009-02-19 13:30:27.000000000 -0500 @@ -1563,11 +1563,11 @@ $list[$m] =~ / ^\* \s+ LIST \s+ \([^\)]*\) \s+ # * LIST (Flags) (?:\" [^"]* \" | NIL ) \s+ # "delimiter" or NIL - (?:\"([^"]*)\" | (\S+)) \s*$ # "name" or name + (?:\" (.*) \" | (\S+)) \s*$ # "name" or name /ix or next; - push @folders, $1 || $2; + push @folders, ( defined($1) ? $self->Unescape($1) : $2 ); } my @clean = _remove_doubles @folders;
Don't expect me to understand the reasoning behind the code, I am just the maintainer ;-b I do not use this module myself, but someone needed to clean it up. So, I only apply patches provided by the specialists (like you) (want to takeover maintenance?) Fixes accepted.