Subject: | append_string fails to get id from APPEND in more complex answer |
Date: | Sun, 19 Apr 2020 14:34:29 +0000 |
To: | "bug-Mail-IMAPClient [...] rt.cpan.org" <bug-Mail-IMAPClient [...] rt.cpan.org> |
From: | Ing. Radomír Polách <radomirpolach [...] protonmail.com> |
I am having answers like these:
20 APPEND Folders/Test (\Seen) "09-Apr-2020 12:21:44 +0000" {3032}+ send literal
* 1 EXISTS
* OK [UNSEEN 0]
* 1 FETCH (FLAGS (\Seen nonjunk) UID 7)
20 OK [APPENDUID 5 7] APPEND successful
This coauses this line:
my $ret = $data =~ m#\s+(\d+)\]# ? $1 : $self;
To produce 0 from [UNSEEN 0].
Needs to be replace with a least something like:
my $ret = $data =~ m#\s+(\d+)\]\s+APPEND# ? $1 : $self;
But I can image more complex answers, for example spaces after id:
20 OK [APPENDUID 5 7 ] APPEND successful
So maybe even:
my $ret = $data =~ m#\s+(\d+)\s+\]\s+APPEND# ? $1 : $self;
The current regular expression is extremely fragile.
Ing. Radomír Polách