File names with accents of attached files in emails for ticket creation got created with nontranslated filenames which render them not accessable.
The attached patch translates the parameters and dparameters of the imap structure returned by the imap_bodystruct function from MIME encoded text to UTF-8.
Tested with accented and non-accented filenames.
It might help with #707908: Attachments from mac mail being saved as noname but I couldn't test.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | support-email_attachments_with_accented_names_2.patch | 1.07 KB | Wergles |
| #6 | testé.txt | 16 bytes | rsevero |
| #4 | support-email_attachments_with_accented_names_2.patch | 1.06 KB | rsevero |
| support-email_attachments_with_accented_names.patch | 802 bytes | rsevero |
Comments
Comment #1
rsevero commentedComment #2
jeremy commentedOut of curiosity, is this code found in other mail handling Drupal modules too? I'd expect other modules to have this same issue, and would be interested in seeing how they solved it.
Comment #3
rsevero commentedI don't know. Just found this problem today and coded this solution right away.
Sorry for not being of much help here.
Comment #4
rsevero commentedImproving the previous patch to prevent errors if some of the properties created by imap_bodystruct are not an array and also ignoring any values that are not strings.
Returning to your question at #2 Jeremy, I don't even know any other Drupal module that deals with incoming emails. I know about a lot of them that deal with outcoming mails though. This is the main reason I don't even know where to look for what others modules might be doing in cases like this.
Comment #5
jeremy commentedIn your patch, you're updating $object but that doesn't get passed anywhere. I'd expect you'd need to update $details for this to impact anything. What am I missing? Also, can you attach an example file I can use to easily test this with?
Comment #6
rsevero commentedRemember that the way PHP passes objects as parameters behaves like passing by reference for most practical matters. Please take a look at http://php.net/manual/en/language.oop5.references.php for detailed info. So the changes done to $details (and $object as it's part of $details) inside _support_get_attachments are propagated to any further access to $details.
I'm attaching a file with a accent in it's name.
Comment #7
rsevero commentedForgot to change status.
Comment #8
rsevero commentedUpdating to latest release version.
Comment #9
jeremy commentedApplying this patch didn't work - however, filenames are accessible with or without this patch:
http://drupalcode.org/project/support.git/commit/32ed8f4
I should have testing /before/ committing. In any case, I reverted the patch:
http://drupalcode.org/project/support.git/commit/2daf715
Another option is to enable the transliteration module, which is now supported:
#810012: Email attachments encoding and filepath problem
Comment #10
Wergles commentedI've regenerated the patch against 6.x-1.8 so it gets applied with no fuzz and no offset.
Cheers.
Comment #13
purencool commented