diff options
-rw-r--r-- | lib/JWebmail/Controller/Webmail.pm | 2 | ||||
-rw-r--r-- | lib/JWebmail/Model/ReadMails/QMailAuthuser.pm | 17 | ||||
-rwxr-xr-x | script/qmauth.py | 2 |
3 files changed, 12 insertions, 9 deletions
diff --git a/lib/JWebmail/Controller/Webmail.pm b/lib/JWebmail/Controller/Webmail.pm index 2f71021..a1d25c3 100644 --- a/lib/JWebmail/Controller/Webmail.pm +++ b/lib/JWebmail/Controller/Webmail.pm @@ -211,7 +211,7 @@ sub readmail { if ($type) { if ($mail->{head}{mime}{content_maintype} eq 'multipart') { - my $content = first {$_->{head}{mime}{content_subtype} eq $type} @{ $mail->{body} }; + my $content = first {$_->{head}{mime}{content_subtype} eq $type} $mail->{body}{parts}->@*; $self->render(text => $content->{body}); } elsif ($mail->{head}{mime}{content_subtype} eq $type) { diff --git a/lib/JWebmail/Model/ReadMails/QMailAuthuser.pm b/lib/JWebmail/Model/ReadMails/QMailAuthuser.pm index 956c137..a61cf01 100644 --- a/lib/JWebmail/Model/ReadMails/QMailAuthuser.pm +++ b/lib/JWebmail/Model/ReadMails/QMailAuthuser.pm @@ -193,7 +193,7 @@ sub execute { close $writer or die 'closing write pipe failed'; - binmode $reader, ':encoding(UTF-8)'; + #binmode $reader, ':encoding(UTF-8)'; my $input = <$reader>; close $reader or die 'closing read pipe failed'; @@ -203,12 +203,15 @@ sub execute { my $resp; if ($rc == 3 || $rc == 0) { - eval { $resp = decode_json $input; 1 } - or $resp = { - info => "error decoding response", - response => $input, - cause => $@, - return_code => $rc, + eval { $resp = decode_json $input if $input; 1 } + or do { + $resp = { + info => "error decoding response", + response => $input, + cause => $@, + return_code => $rc, + }; + $rc = 3; }; } elsif ($rc) { diff --git a/script/qmauth.py b/script/qmauth.py index 7803483..052b8dd 100755 --- a/script/qmauth.py +++ b/script/qmauth.py @@ -202,7 +202,7 @@ def count_mails(f, subfolder): def _get_body(mail): if not mail.is_multipart(): if mail.get_content_maintype() == 'text': - return mail.get_payload(decode=True).decode() + return mail.get_payload(decode=True).decode(errors='replace') else: return mail.get_payload() |