Skip Menu |

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

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

People
Owner: PLOBBES [...] cpan.org
Requestors: jason [...] long.name
Cc:
AdminCc:

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



Subject: internaldate() returns corrupt data if server does not include internaldate in reply
The code: my $datestr = $IMAP->internaldate($i) or die "Could not internaldate: $@\n"; What the IMAPClient sends: 192 UID FETCH 23 INTERNALDATE What the IMAPClient gets from the IMAP server: * 23 FETCH (UID 23) 192 OK UID FETCH completed Yeah, I suppose the server is in error there; I guess it is supposed to include the internaldate. But it doesn't. The internaldate() method returns garbage in this case. Please make it so that internaldate() throws an error or returns undef. Either would be better than returning '* 23 FETCH...'. Thanks.
Agreed, this behavior is not desirable. Either undef or "" would be better candidates. I believe undef is probably the best solution so I'll include a patch to the next release to do that. Thanks for reporting this bug!
Here's a preview of the patch to be released with version 3.28: @@ -2674,10 +2674,8 @@ sub internaldate { my ( $self, $msg ) = @_; $self->_imap_uid_command( FETCH => $msg, 'INTERNALDATE' ) or return undef; - my $internalDate = join '', $self->History; - $internalDate =~ s/^.*INTERNALDATE "//si; - $internalDate =~ s/\".*$//s; - $internalDate; + my $hist = join '', $self->History; + return $hist =~ /\bINTERNALDATE "([^"]*)"/i ? $1 : undef; }
Mail::IMAPClient 3.28 released today!