Bug 40041

Summary: Thunderbird 5 needs unescaped addresses
Product: Portland Reporter: Tomas Bzatek <bugs>
Component: xdg-utilsAssignee: Portland Bugs <portland-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: bugs
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: proposed patch
patch fixing attachments

Description Tomas Bzatek 2011-08-12 06:36:50 UTC
Created attachment 50158 [details] [review]
proposed patch

Thunderbird 5 (and probably also TB 3) expects unescaped strings passed for To:, Cc: and BCc: fields. With the current xdg-email version Thunderbird uses escaped strings as addresses. This is not true for Subject and Body fields where strings are properly unescaped by TB itself. Truly inconsistent behaviour.

The attached patch unescapes address fields back to plain text. I don't think this is the cleanest solution but it's not intrusive at least. Proper way could be to pass original strings directly (saving them aside when parsing commandline args) but the script architecture would need to be altered.

Current behaviour:
> $ XDG_UTILS_DEBUG_LEVEL=99 ./xdg-email --to 'John Doe <nobody@example.cz>' --cc 'Copy machine <nobody@example.cz>' --bcc 'Big Brother <nobody@example.cz>' --subject 'Hello world!' --body 'Hi, this is the body.'
> Running thunderbird -compose "to='John%20Doe%20<nobody@example.cz>,',cc='Copy%20machine%20<nobody@example.cz>,',bcc='Big%20Brother%20<nobody@example.cz>,',subject=Hello%20world%21,body=Hi%2C%20this%20is%20the%20body."
Comment 1 Rex Dieter 2011-08-12 07:09:10 UTC
eww, fun.

Patch looks like a winner to me, applied.

commit 241682726eb96342bd80e1b64351d6050bc1f22d
Author: Tomas Bzatek <tbzatek@redhat.com>
Date:   Fri Aug 12 15:33:48 2011 +0200

    xdg-email: Pass unescaped addresses for Thunderbird 5
Comment 2 Tomas Bzatek 2011-08-12 08:37:06 UTC
Created attachment 50165 [details] [review]
patch fixing attachments

Wow, that was fast, thanks!

Regarding attachments: first I thought that inability to add an attachment was caused by incorrect escaping of file URI (bug 13139) but turned out that Thunderbird really needs pure unescaped path to the attachment, again.

Attaching second patch, unescaping the attachment strings.

Reopening this bugreport to make the fix complete.
Comment 3 Tomas Bzatek 2011-08-12 08:37:33 UTC
One more thing: any comma in the address or attached filename would cause arguments to be split. I tried to quote multiple attachment filenames by an apostrophe so the string would look like 
> Running thunderbird -compose "to='John, Doe <nobody@example.cz>,',cc='Copy machine <nobody@example.cz>,',bcc='Big Brother <nobody@example.cz>,',subject=Hello%20world%21,body=Hi%2C%20this%20is%20the%20body.,attachment='/tmp/Nabídkový_rozpočet_vše.pdf',attachment='/tmp/Další Nabídkový_rozpočet_vše.pdf'"
or 
> ... ,attachment='/tmp/Nabídkový_rozpočet_vše.pdf','/tmp/Další Nabídkový_rozpočet_vše.pdf'"
but didn't have luck. I know this is solved by escaping but since TB doesn't understand it...
Comment 4 Tomas Bzatek 2011-08-12 09:13:45 UTC
Filed upstream: https://bugzilla.mozilla.org/show_bug.cgi?id=678521
Comment 5 Rex Dieter 2011-08-12 09:43:13 UTC
OK, committed.
commit 11bdb3111dc77147fa323b99532820fcd7b537df
Author: Rex Dieter <rdieter@fedoraproject.org>
Date:   Fri Aug 12 11:42:01 2011 -0500

    +changelog for prior commit(s)

commit 3860278a0a7af1a4d81c715c8983619966f7122e
Author: Tomas Bzatek <tbzatek@redhat.com>
Date:   Fri Aug 12 17:34:37 2011 +0200

    xdg-email: Unescape the attachment string for Thunderbird 5 too
    
    Please see https://bugs.freedesktop.org/show_bug.cgi?id=40041



would you prefer we keep this open pending feedback from mozilla bz or not?
Comment 6 Tomas Bzatek 2011-08-12 09:48:19 UTC
(In reply to comment #5)
> OK, committed.
Thanks again!

> would you prefer we keep this open pending feedback from mozilla bz or not?

I don't believe we will find solution anytime near, I'll keep watching the mozilla bugzilla and will open a separate bugreport then. Closing for now.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.