#1487634 closed Bugs (fixed)
Problems with rcube_imap.php (method get_message_part)
| Reported by: | rosali | Owned by: | |
|---|---|---|---|
| Priority: | 5 | Milestone: | 0.5-stable |
| Component: | PHP backend | Version: | 0.5-beta |
| Severity: | normal | Keywords: | |
| Cc: |
Description
I'm currently refactoring calendar plugin and encountered
a serious problem with IMAP->get_message_part.
If the ics attachment contains header ...
Content-Disposition: attachment; filename=calendar.ics
... the the charset conversion fails. It defaults to ISO-8859-1
even if charset UTF-8 is present.
This results in returning a messed up part. Everything is ok
(except that download link isn't shown), if Content-Disposition header is not present.
This is a serious problem, because I can't process ICS attachments properly.
Example messages are attached.
Attachments (2)
Change History (11)
Changed 2 years ago by rosali
Changed 2 years ago by rosali
comment:1 Changed 2 years ago by alec
- Milestone changed from later to 0.5-stable
comment:2 Changed 2 years ago by rosali
Do you mean $o_part in get_message_part?
The good one:
[13-Dec-2010 14:52:00 +0100]: rcube_message_part::__set_state(array(
'mime_id' => '1.2',
'ctype_primary' => 'text',
'ctype_secondary' => 'html',
'mimetype' => 'text/html',
'disposition' => '',
'filename' => '',
'encoding' => 'quoted-printable',
'charset' => 'UTF-8',
'size' => 431,
'headers' =>
array (
'content-transfer-encoding' => 'quoted-printable',
),
'd_parameters' =>
array (
),
'ctype_parameters' =>
array (
'charset' => 'UTF-8',
),
'type' => 'content',
))
[13-Dec-2010 14:52:02 +0100]: rcube_message_part::__set_state(array(
'mime_id' => '',
'ctype_primary' => 'text',
'ctype_secondary' => 'plain',
'mimetype' => 'text/plain',
'disposition' => '',
'filename' => '',
'encoding' => 'base64',
'charset' => '',
'size' => 0,
'headers' =>
array (
),
'd_parameters' =>
array (
),
'ctype_parameters' =>
array (
),
))
The bad one ...
[13-Dec-2010 14:52:18 +0100]: rcube_message_part::__set_state(array(
'mime_id' => '1.2',
'ctype_primary' => 'text',
'ctype_secondary' => 'html',
'mimetype' => 'text/html',
'disposition' => '',
'filename' => '',
'encoding' => 'quoted-printable',
'charset' => 'UTF-8',
'size' => 431,
'headers' =>
array (
'content-transfer-encoding' => 'quoted-printable',
),
'd_parameters' =>
array (
),
'ctype_parameters' =>
array (
'charset' => 'UTF-8',
),
'type' => 'content',
))
[13-Dec-2010 14:52:18 +0100]: rcube_message_part::__set_state(array(
'mime_id' => '',
'ctype_primary' => 'text',
'ctype_secondary' => 'plain',
'mimetype' => 'text/plain',
'disposition' => '',
'filename' => '',
'encoding' => 'base64',
'charset' => 'UTF-8',
'size' => 0,
'headers' =>
array (
),
'd_parameters' =>
array (
),
'ctype_parameters' =>
array (
),
))
comment:3 Changed 2 years ago by alec
No, enable imap_debug and check your server response.
comment:4 Changed 2 years ago by rosali
The bad one:
[13-Dec-2010 15:45:43 +0100]: S: * 329 FETCH (UID 1524 BODYSTRUCTURE ((("TEXT" "PLAIN" ("CHARSET" "UTF-8") NIL NIL "7bit" 319 25)("TEXT" "HTML" ("CHARSET" "UTF-8") NIL NIL "quoted-printable" 431 9) "ALTERNATIVE" ("BOUNDARY" "=_921d883e28a7657b83c4ee7976a8f0b1") NIL NIL)("TEXT" "CALENDAR" ("NAME" "calendar.ics") NIL NIL "base64" 324 5 NIL ("attachment" ("FILENAME" "calendar.ics"))) "MIXED" ("BOUNDARY" "=_e0435d8a3efd08447d7e71bc5641b9f3") NIL NIL))
The good one:
[13-Dec-2010 15:46:17 +0100]: S: * 328 FETCH (UID 1522 BODYSTRUCTURE ((("TEXT" "PLAIN" ("CHARSET" "UTF-8") NIL NIL "7bit" 319 25)("TEXT" "HTML" ("CHARSET" "UTF-8") NIL NIL "quoted-printable" 431 9) "ALTERNATIVE" ("BOUNDARY" "=_bb0b7d126d4ed928b567f1ec21e7a88a") NIL NIL)("TEXT" "CALENDAR" ("CHARSET" "UTF-8") NIL NIL "base64" 324 5) "MIXED" ("BOUNDARY" "=_10d75c8aa9e6a816989721a36f881f1f") NIL NIL))
comment:5 Changed 2 years ago by alec
- Resolution set to wontfix
- Status changed from new to closed
Looks like IMAP server issue.
comment:6 Changed 2 years ago by rosali
Yes, I see the issue.
At least do not force encoding to default charset and return part as is!
comment:7 Changed 2 years ago by rosali
- Resolution wontfix deleted
- Status changed from closed to reopened
comment:8 Changed 2 years ago by alec
- Resolution set to fixed
- Status changed from reopened to closed
Fixed in [9840ab69]. I think this change may produce new issues, but doing that this way is probably better.
comment:9 Changed 2 years ago by alec
I've reverted the change in [8abc1761]. However, I've added 6th argument to get_message_part() function. You can use it to handle this specific situation.

Check BODYSTRUCTURE response from your IMAP server for both messages.