No attachment when Thunderbird is set as default client.

Bug #515386 reported by Saivann Carignan
152
This bug affects 32 people
Affects Status Importance Assigned to Milestone
Mozilla Thunderbird
New
Undecided
Unassigned
Xdg-utils
New
Undecided
Unassigned
xdg-utils (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

Currently, when thunderbird is set as the default email client, when simple-scan tries to open a new message using mailto: , a new message window is opened for thunderbird, but there are no attachment.

This is probably due to Thunderbird who does not support attachment with mailto because it is considered unsecure, but still, this makes user experience very poor, as the user is left thinking "ok a new window opened, therefore the attachment must be somewhere..". And thunderbird is pretty popular.

Fortunately this might be easy to "workaround". Picasa already did it using xdg-email script that I attached since its code show exactly what's needed. the run_thunderbird() function is the more important part in the file.

Revision history for this message
In , Lei Zhang (thestig-google) wrote :

Created an attachment (id=12807)
proposed fix

Revision history for this message
In , Noël Köthe (noel) wrote :

will the proposed fix from Comment #1 be integrated?

Revision history for this message
In , Nicolas Lécureuil (neoclust) wrote :

fabo, can you review this patch please ?

Revision history for this message
In , Chris Mohler (cr33dog) wrote :

Can confirm bug, and also that the patch works.

Revision history for this message
In , Fathi Boudra (fboudra) wrote :
Revision history for this message
Saivann Carignan (oxmosys) wrote :

Currently, when thunderbird is set as the default email client, when simple-scan tries to open a new message using mailto: , a new message window is opened for thunderbird, but there are no attachment.

This is probably due to Thunderbird who does not support attachment with mailto because it is considered unsecure, but still, this makes user experience very poor, as the user is left thinking "ok a new window opened, therefore the attachment must be somewhere..". And thunderbird is pretty popular.

Fortunately this might be easy to "workaround". Picasa already did it using xdg-email script that I attached since its code show exactly what's needed. the run_thunderbird() function is the more important part in the file.

Revision history for this message
Saivann Carignan (oxmosys) wrote :
Changed in simple-scan:
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Robert Ancell (robert-ancell) wrote :

Hi, thanks for this. I use Thunderbird too so it was annoying me too... I'm not sure where the patch should go (workaround in simple-scan, fix xdg-email, fix thunderbird) but I want this to work before Lucid is released.

Revision history for this message
Saivann Carignan (oxmosys) wrote :

May I suggest to fix this in xdg-email? According to upstream bug report, this patch has been included in r1.28 of xdg-email on Mon Oct 12 14:51:22 2009 UTC , therefore this might simply requires to update xdg-email packaging in ubuntu, or at least to add this patch since it seems to be supported upstream.

http://bugs.freedesktop.org/show_bug.cgi?id=13435

Changed in xdg-utils:
status: Unknown → Fix Released
Changed in xdg-utils (Ubuntu):
status: New → Triaged
importance: Undecided → Medium
Changed in simple-scan:
status: Triaged → Invalid
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package xdg-utils - 1.0.2-6.1ubuntu2

---------------
xdg-utils (1.0.2-6.1ubuntu2) lucid; urgency=low

  * debian/patches/xdg-email-thunderbird.diff:
    - Make xdg-email attachments work with Thunderbird (LP: #515386)
  * debian/patches/xdg-email-attachment-url-escape.diff:
    - Fix xdg-email attachment URL escape bug (LP: #408350)
  * debian/control:
    - Add Vcs-Bzr link
 -- Robert Ancell <email address hidden> Mon, 15 Feb 2010 11:50:53 +1100

Changed in xdg-utils (Ubuntu):
status: Triaged → Fix Released
Revision history for this message
Saivann Carignan (oxmosys) wrote :

I confirm that this bug is fixed, thank you very much, that was quick and well done :-) The great thing is that any future app will also be able to send attachments correctly with thunderbird, not only simple-scan.

Revision history for this message
In , Saivann Carignan (oxmosys) wrote :

User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/532.9 (KHTML, like Gecko) Chrome/5.0.307.9 Safari/532.9
Build Identifier: 3.0.2

Thunderbird 3.0.2 has two important regressions in the way it handle arguments of -compose command line option compared to Thunderbird 2.0 :

This used to work perfectly with thunderbird 2.0 :
thunderbird -compose "attachment='file:///scan%2D0.pdf,'"

With Thunderbird 3.0.1, It shows a error message that say : "An error occurred while creating a message compose window. Please try again." This is caused by the virgule at the end of the attachment.

If we remove this virgule, thunderbird hit another regression, the attachment filename is not renamed to scan-0.pdf, therefore thunderbird is not able to find scan%2D0.pdf .

That does not make sense, because URLencoded filenames is necessary here to seperate each file correctly.

xdg-email recently included a fix to add Thunderbird compatibility for Linux operating systems, because Thunderbird does not support attachments with mailto. These two regressions unfortunately break this recent fix, and prevent all applications to send email attachments when Thunderbird 3 is set as the default email client on Linux.

Summary :
1. Thunderbird show a error msg when there is a virgule at the end of last attachment filename.
2. Thunderbird does not convert URLEncoded filenames to normal strings, leading it to think that the file does not exist anymore.

This has been tested under Windows XP as well.

Reproducible: Always

Steps to Reproduce:
1. Create a file named scan-0.pdf at the root of your filesystem (/)
2. Attach the file in thunderbird via command line : thunderbird -compose "attachment='file:///scan%2D0.pdf,'" (Linux) or thunderbird.exe -compose "attachment='file://C:/scan%2D0.pdf,'" (Windows).
Actual Results:
Thunderbird ends on a error message saying "An error occurred while creating a message compose window. Please try again." because of the virgule. And without the virgule, it attach scan%2D0.pdf to the message.

Expected Results:
Thunderbird should not report any error and simply ignore the virgule, as it did in the past, and it should convert the filename to scan-0.pdf.

This issue is also tracked in launchpad bug :
https://bugs.launchpad.net/simple-scan/+bug/515386

Revision history for this message
In , Saivann Carignan (oxmosys) wrote :
Revision history for this message
Saivann Carignan (oxmosys) wrote :

Robert Ancell : I've subscribed you to this bug as the issue with thunderbird re-appeared since it has been updated to v3 and because you mentionned that this issue was important to be fixed for Lucid. This time, it is a regression in Thunderbird itself, which affect the -compose command line.

Alexander Sack : May I ask you if there is something else we can do to your knowledge with mozilla projects to make sure that this gets fixed in thunderbird before Lucid hit stable?

I've reported all details about the regression in upstream bug report :
https://bugzilla.mozilla.org/show_bug.cgi?id=549058

summary: - No attachment when thunderbird is set as default client.
+ No attachment when thunderbird 3 is set as default client.
Revision history for this message
In , Pablo Castellano (pablocastellano) wrote :

Created an attachment (id=33640)
to_thunderbird.diff

Hi Fathi.
It looks like you committed the patch with an error and the "TO:" field isn't working.

Here's a patch to fix it.

Revision history for this message
In , Pablo Castellano (pablocastellano) wrote :

"TO:" field is not working.
Patch attached

Revision history for this message
In , Fathi Boudra (fboudra) wrote :

oups, sorry. fixed.

Revision history for this message
In , Saivann Carignan (oxmosys) wrote :

Unfortunately, this fix does not work anymore with thunderbird 3, because of two regressions in the way thunderbird 3 handle -compose. I've reported the issue in thunderbird bugzilla and all details about this problem can be found here :

https://bugzilla.mozilla.org/show_bug.cgi?id=549058

I guess that this has to be fixed in thunderbird and not xdg-utils, but I might be wrong.

Changed in xdg-utils:
status: Fix Released → Confirmed
Changed in xdg-utils:
status: Confirmed → Fix Released
Revision history for this message
In , Robert Ancell (robert-ancell) wrote :

Strips the trailing comma as required by Thunderbird 3:
ATTACH=$(echo "$MAILTO" | sed 's/^attach=/\n\nfile:\/\//g' | awk '/^file:/ { printf "%s,",$0 }')
ATTACH=$(echo "$ATTACH" | sed 's/,$//')

Revision history for this message
In , Mozilla-bugs-micahscomputing (mozilla-bugs-micahscomputing) wrote :

Moving to OS Integration component, seems there is no way to pass special characters in attachments from the CLI to have the proper files be attached. I can confirm this on:
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9pre) Gecko/20100309 Lightning/1.0b1 Shredder/3.0.4pre on Ubuntu Karmic

Revision history for this message
Robert Ancell (robert-ancell) wrote : Re: No attachment when thunderbird 3 is set as default client.

Has anyone checked if this is a problem is 3.0.3?

Changed in thunderbird (Ubuntu):
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Micah Gersten (micahg) wrote :

I'm replying to upstream bug here:
Why is this a regression? It seems like the comma is superfluous. Where does it say that the comma is ignored in previous releases? Why can't simple scan just not send the comma if no other parameters are specified?

Revision history for this message
Robert Ancell (robert-ancell) wrote :

This is not due to simple-scan. Simple scan is using xdg-email which must be adding the comma. Any awk experts who can fix it so xdg-email doesn't add the last comma?

Revision history for this message
Robert Ancell (robert-ancell) wrote :

Fixed by adding the second line:
ATTACH=$(echo "$MAILTO" | sed 's/^attach=/\n\nfile:\/\//g' | awk '/^file:/ { printf "%s,",$0 }')
ATTACH=$(echo "$ATTACH" | sed 's/,$//')

Revision history for this message
Saivann Carignan (oxmosys) wrote :

Micah Gersten : I considered this as a regression because thunderbird 2.* supported this pretty well, but I would understand mozilla for refusing to fix this as it is not part of any specification (and just not necessary anyway). Robert Ancell fix seems good at a first glance.

However the second problem (thunderbird not decoding urlencoded spaces and special characters) definitively seems to be a bug that needs to be fixed in Thunderbird IMO as there are apparently no ways to have special characters or spaces in attachment filenames if thunderbird don't fix this regression. This also worked correctly in TB 2.* .

I didn't find any mention of this bugfix in 3.0.3 release notes, but I will give a try.

Revision history for this message
Robert Ancell (robert-ancell) wrote :

Comma fix released as xdg-utils 1.0.2-6.1ubuntu3

Revision history for this message
Saivann Carignan (oxmosys) wrote :

3.0.4pre does not fix the second issue, tested from mozilla daily PPA

Revision history for this message
Micah Gersten (micahg) wrote : Re: [Bug 515386] Re: No attachment when thunderbird 3 is set as default client.

A standard space seems to work for me since it's in quotes.

On 03/11/2010 11:46 PM, Saïvann Carignan wrote:
> Micah Gersten : I considered this as a regression because thunderbird
> 2.* supported this pretty well, but I would understand mozilla for
> refusing to fix this as it is not part of any specification (and just
> not necessary anyway). Robert Ancell fix seems good at a first glance.
>
> However the second problem (thunderbird not decoding urlencoded spaces
> and special characters) definitively seems to be a bug that needs to be
> fixed in Thunderbird IMO as there are apparently no ways to have special
> characters or spaces in attachment filenames if thunderbird don't fix
> this regression. This also worked correctly in TB 2.* .
>
> I didn't find any mention of this bugfix in 3.0.3 release notes, but I
> will give a try.
>
>

Revision history for this message
In , Saivann Carignan (oxmosys) wrote :

Micah Gersten : As a reminder, this bug also affect Windows. -compose syntax is broken here as well. However sending attachments from Windows explorer, or Picasa works, which means that Windows probably use some different way to attach files in thunderbird than the -compose CLI syntax.

But if someone was to manually use -compose under Windows, he would be in the exact same situation.

Revision history for this message
Saivann Carignan (oxmosys) wrote : Re: No attachment when thunderbird 3 is set as default client.

Micah Gersten : Urlencoding was here to protect the syntax. If we don't urlencode special characters, what happens if a filename contains a single quote ', a double quote " or a virgule , ? Ex. : thunderbird -compose "attachment='file:///file\,g'".

The result is that the whole syntax is broken, because thunderbird interpret the character while it should not. Therefore yes using a space without urlencoding works with TB3, but accepting this syntax means :

1. Accepting that some filenames won't work at all (which is a bug IMO).
2. Accepting that xdg-email will have no way to be both compatible with TB2 and TB3, therefore affecting all applications that might use xdg-email to send mails with attachments until TB3 gets into every distributions that uses it.

Revision history for this message
In , Ben-bucksch (ben-bucksch) wrote :

> Windows probably use some different way to attach files in thunderbird

Yes, MAPI. We support that.

Changed in xdg-utils:
status: Fix Released → Confirmed
Changed in thunderbird:
status: Unknown → Confirmed
Revision history for this message
In , Pablo Castellano (pablocastellano) wrote :

Created an attachment (id=35340)
thunderbird_trailing_comma.diff

Patch tested and working following Robert's last comment.

Revision history for this message
In , Pablo Castellano (pablocastellano) wrote :

a friendly ping, can we finally patch&close this bug?

Changed in xdg-utils:
importance: Unknown → Medium
Changed in thunderbird:
importance: Unknown → High
Revision history for this message
In , Fathi Boudra (fboudra) wrote :

fixed in CVS

Changed in xdg-utils:
status: Confirmed → Fix Released
Revision history for this message
In , Rich Wales (richw) wrote :

I appear to be affected by this bug on two Ubuntu systems (one Maverick, one Jaunty). Picasa can no longer e-mail photos since I upgraded to Thunderbird 3 on both systems.

Revision history for this message
Rich Wales (richw) wrote : Re: No attachment when thunderbird 3 is set as default client.

I believe I am still being affected by this bug. On an up-to-date Maverick, I cannot e-mail photos from Picasa 2.7 to Thunderbird 3.1.6; Picasa says "An error occurred while creating a message compose window. Please try again."

The version of xdg-utils installed on this box is "1.0.2+cvs20100307-1". I'm definitely willing to try a newer xdg-utils, but I would be grateful for directions (pointer to a PPA, etc.).

Changed in xdg-utils:
importance: Medium → Unknown
Changed in xdg-utils:
importance: Unknown → Medium
Revision history for this message
Alfagulf (alfagulf) wrote :

I am using Oneiric 64Bit.
Simple Scan does not attach the document when I use Thunderbird Ver. 8.0 as a default email client.
However, attachment works when I use Evolution!!!

Is there a workaround?

Revision history for this message
Rüdiger Kupper (ruediger.kupper) wrote :

Confirm it does NOT work with Thunderbird 11.0.1 (Oneiric). Mail window opens, but has NO attachments,

Revision history for this message
Aditya V (kroq-gar78) wrote : Re: [Bug 515386] Re: No attachment when thunderbird 3 is set as default client.

It doesn't work with Precise Beta 2 either. I'm pretty sure this isn't just an issue with Thunderbird 3, but 3+. I think Precise has 11.

Sincerely,
kroq-gar78
On Apr 7, 2012 6:25 PM, Rüdiger Kupper &lt;<email address hidden>&gt; wrote:

Confirm it does NOT work with Thunderbird 11.0.1 (Oneiric). Mail window

opens, but has NO attachments,

--

You received this bug notification because you are subscribed to a

duplicate bug report (880651).

https://bugs.launchpad.net/bugs/515386

Title:

  No attachment when thunderbird 3 is set as default client.

Status in Simple Scan:

  Invalid

Status in Mozilla Thunderbird Mail and News:

  Confirmed

Status in Xdg-utils:

  Fix Released

Status in “thunderbird” package in Ubuntu:

  Triaged

Status in “xdg-utils” package in Ubuntu:

  Fix Released

Bug description:

  Currently, when thunderbird is set as the default email client, when

  simple-scan tries to open a new message using mailto: , a new message

  window is opened for thunderbird, but there are no attachment.

  This is probably due to Thunderbird who does not support attachment

  with mailto because it is considered unsecure, but still, this makes

  user experience very poor, as the user is left thinking "ok a new

  window opened, therefore the attachment must be somewhere..". And

  thunderbird is pretty popular.

  Fortunately this might be easy to "workaround". Picasa already did it

  using xdg-email script that I attached since its code show exactly

  what's needed. the run_thunderbird() function is the more important

  part in the file.

To manage notifications about this bug go to:

https://bugs.launchpad.net/simple-scan/+bug/515386/+subscriptions

Aditya V (kroq-gar78)
summary: - No attachment when thunderbird 3 is set as default client.
+ No attachment when Thunderbird is set as default client.
Revision history for this message
In , cameleon (el-cameleon-1) wrote :

This bug prevents me to send my files scanned with simple-scan by email when using the "File", "Mail" menu of simple-scan.

I am using Ubuntu 12.04 and Thunderbird 15.

Very poor experience for Ubuntu users :-(

Revision history for this message
In , Mkmelin+mozilla (mkmelin+mozilla) wrote :

Vincent, your issue is likely not this one. I think this was bug 627999.

See http://kb.mozillazine.org/Command_line_arguments_(Thunderbird) for syntax.

*** This bug has been marked as a duplicate of bug 627999 ***

Changed in thunderbird:
status: Confirmed → Invalid
Revision history for this message
Michael Nagel (nailor) wrote :

hmmm:

this works:
thunderbird -compose "attachment='file:///etc/hostname'"
it creates an email with attachment

this does not work:
XDG_UTILS_DEBUG_LEVEL=100 xdg-email --attach /etc/hostname
it creates an email withou attachment and prints the following debug output:
DE is "gnome"
Checking /usr/share/ubuntu/applications/defaults.list
Checking /usr/share/gnome/applications/defaults.list
Running gvfs-open "mailto:?attach=/etc/hostname"

Revision history for this message
Gabriel (rossetti-gabriel) wrote :

I confirm comment #42, on Ubuntu 12.10 this does not work, I still get the Thunderbird email without the attachment. I am using Thunderbird 17.0.4.

Revision history for this message
Johnny Arthur (ubuntu-hwbqs69) wrote :

Hi,
i have the same problem with raring.
for me there seem to be at least 2 errors in the script:
in open_gnome the wrong variable is used to find the desktop file (browser instead of desktop)
and in desktop_file_to_binary() the grep command finds multiple occurences of 'Exec'. The supposed patch below only takes the first one and removes all following lines.

hence i suppose the following changes, that seem to work for me:

@@ -319,11 +319,11 @@
         unset IFS
         [ "$dir" -a -d "$dir/applications" ] || continue
         file="$dir/applications/$desktop"
         [ -r "$file" ] || continue
         # Remove any arguments (%F, %f, %U, %u, etc.).
- command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | sed -e 's/ .*$//'`"
+ command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -s -d= -f 2- | sed -e 's/ .*$//;2,$d'`"
         command="`which "$command"`"
         readlink -f "$command"
         return
     done
 }
@@ -510,11 +510,11 @@
 open_gnome()
 {
     local client
     local desktop
     desktop=`xdg-mime query default "x-scheme-handler/mailto"`
- client=`desktop_file_to_binary "$browser"`
+ client=`desktop_file_to_binary "$desktop"`
     echo $client | grep thunderbird > /dev/null 2>&1
     if [ $? -eq 0 ] ; then
         run_thunderbird "$client" "$1"
     fi

Revision history for this message
manolo (mac-man2005) wrote :

I'm sorry to inform you that the problem persists between Simple Scan 3.6.0 and TB 17.0.6 installed on Linux Mint 14.
The problem did not appear on Kubuntu 12.10
What should I do?

Thanks,
regards.

Revision history for this message
Matthias Hafner (hafner-matthias) wrote :

The workaround in xdg-email does not work in Ubuntu 13.04 for Thunderbird.

The workaround includes looking up and parsing thunderbird.desktop to finally call thunderbird. Maybe there could be an easier solution?

xdg-email currently ends up with calling gvfs-open "mailto:?attach=..." what does not work with thunderbird due to some strange security policies.

This should be fixed within xdg-email in my opinion. Can somebody please reopen https://bugs.freedesktop.org/show_bug.cgi?id=13435

Revision history for this message
In , Matthias Hafner (hafner-matthias) wrote :

The workaround in xdg-email does not work in Ubuntu 13.04 for Thunderbird.

The workaround includes looking up and parsing thunderbird.desktop to finally call thunderbird. Maybe there could be an easier solution?

xdg-email currently ends up with calling gvfs-open "mailto:?attach=..." what does not work with thunderbird due to some strange security policies.

Revision history for this message
Matthias Hafner (hafner-matthias) wrote :

this bug should be reopened

Changed in xdg-utils:
importance: Medium → Undecided
status: Fix Released → New
Revision history for this message
Rolf Leggewie (r0lf) wrote :

this problem was apparently dealt with in xdg-utils for ubuntu, nothing left to be done for thunderbird package

Changed in thunderbird (Ubuntu):
status: Triaged → Invalid
Revision history for this message
Geb (gebhard-moser) wrote :

Linux Mint 16 (based on Ubuntu 13.10):
new email window opens but no file attached -> problem still persists

Changed in thunderbird (Ubuntu):
status: Invalid → New
affects: simple-scan → simple-scan (Ubuntu)
Changed in simple-scan (Ubuntu):
status: Invalid → New
Changed in thunderbird:
importance: High → Undecided
status: Invalid → New
Revision history for this message
Amr Ibrahim (amribrahim1987) wrote :

This bug is still in trusty.

tags: added: regression-release trusty
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in simple-scan (Ubuntu):
status: New → Confirmed
Changed in thunderbird (Ubuntu):
status: New → Confirmed
Revision history for this message
Alex (just4fun73de-1) wrote :

Also effect ubuntu 14.04

Revision history for this message
Christoph Weber (wewa) wrote :

Also Linux Mint 17 is affected.

Revision history for this message
Thomas E. Horner (thomas.horner) wrote :

with the following patch "simple-scan" -> "Email" works correctly on Ubuntu 14.10 again:

the first change makes sure that only the first occurrence of Exec in thunderbird's desktop file is considered: | head -n 1.
the second change is a fix for what is clearly a bug (having $browser instead of the correct variable $desktop).

diff -u org/xdg-email fixed/xdg-email
--- org/xdg-email 2014-07-16 11:43:48.000000000 +0200
+++ fixed/xdg-email 2014-12-30 17:44:27.990930489 +0100
@@ -321,7 +321,7 @@
         file="$dir/applications/$desktop"
         [ -r "$file" ] || continue
         # Remove any arguments (%F, %f, %U, %u, etc.).
- command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | sed -e 's/ .*$//'`"
+ command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | sed -e 's/ .*$//' | head -n 1`"
         command="`which "$command"`"
         readlink -f "$command"
         return
@@ -512,7 +512,7 @@
     local client
     local desktop
     desktop=`xdg-mime query default "x-scheme-handler/mailto"`
- client=`desktop_file_to_binary "$browser"`
+ client=`desktop_file_to_binary "$desktop"`
     echo $client | grep thunderbird > /dev/null 2>&1
     if [ $? -eq 0 ] ; then
         run_thunderbird "$client" "$1"

Revision history for this message
Thomas Guettler (guettli-lp) wrote :

Is there a way to write a unittest for this, to make this bug never appear again in Ubuntu?

Revision history for this message
Thomas E. Horner (thomas.horner) wrote :

with the following patch "simple-scan" -> "Email" works correctly on Ubuntu 15.04 again:

diff -u org/xdg-email fixed/xdg-email
--- org/xdg-email 2015-01-26 09:14:22.000000000 +0100
+++ fixed/xdg-email 2015-07-15 15:33:30.353509685 +0200
@@ -321,7 +321,7 @@
         file="$dir/applications/$desktop"
         [ -r "$file" ] || continue
         # Remove any arguments (%F, %f, %U, %u, etc.).
- command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | sed -e 's/ .*$//'`"
+ command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | head -n 1 | cut -d= -f 2- | sed -e 's/ .*$//'`"
         command="`which "$command"`"
         readlink -f "$command"
         return
@@ -512,7 +512,7 @@
     local client
     local desktop
     desktop=`xdg-mime query default "x-scheme-handler/mailto"`
- client=`desktop_file_to_binary "$browser"`
+ client=`desktop_file_to_binary "$desktop"`
     echo $client | grep thunderbird > /dev/null 2>&1
     if [ $? -eq 0 ] ; then
         run_thunderbird "$client" "$1"

the first change makes sure that only the first occurrence of Exec in thunderbird's desktop file is considered: | head -n 1.
the second change is a fix for what is clearly a bug (having $browser instead of the correct variable $desktop).
it's a little sad to see nothing happen here as this is a pain for a lot of users and quite easy to fix.

Revision history for this message
Amr Ibrahim (amribrahim1987) wrote :

Robert Ancell, could you please review that patch and, if applicable, apply for wily, vivid and trusty? Thanks.

Revision history for this message
ippsatsi (laz133) wrote :

In Xubuntu 14.04.2 no problem. In Ubuntu 14.04 i have the same problem without attachment.

no longer affects: simple-scan (Ubuntu)
no longer affects: thunderbird (Ubuntu)
Revision history for this message
Robert Ancell (robert-ancell) wrote :

Please open new bugs for this - it's very confusing to re-use existing bugs for new issues.

The two issues indicated are:

1. xdg-email doesn't handle having more than one Exec entry in a .desktop file. This is a new feature (called Quicklists in Ubuntu) that was added to the specification [1] and didn't exist at time this issue was raised.

2. There is a bug in the patch gnome-3.0.diff which is not present in the associated upstream change. This patch was added due to bug 670128 in 2011 - after this original issue was raised.

[1] http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s10.html#extra-actions-keys

Revision history for this message
Thomas E. Horner (thomas.horner) wrote :

Updated fix for 15.10

--- xdg-email.old 2015-09-16 22:36:49.000000000 +0200
+++ xdg-email.new 2016-01-18 16:38:29.755859228 +0100
@@ -225,7 +225,7 @@
         file="$dir/applications/$desktop"
         [ -r "$file" ] || continue
         # Remove any arguments (%F, %f, %U, %u, etc.).
- command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | sed -e 's/ .*$//'`"
+ command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | head -n 1 | cut -d= -f 2- | sed -e 's/ .*$//'`"
         command="`which "$command"`"
         readlink -f "$command"
         return
@@ -648,7 +648,7 @@
     local client
     local desktop
     desktop=`xdg-mime query default "x-scheme-handler/mailto"`
- client=`desktop_file_to_binary "$browser"`
+ client=`desktop_file_to_binary "$desktop"`
     echo $client | grep thunderbird > /dev/null 2>&1
     if [ $? -eq 0 ] ; then
         run_thunderbird "$client" "$1"

Revision history for this message
chrysoberyl (lnxme1) wrote :

Is this bug fixed in Ubuntu Trusty 64 (LTS!) ?

I'am still unable to send emails with their attachments from simple scan.

Thunderbird open up a new message but, but nothing is attached to it.

Should I open yet another bug report? Will this bug show its ugly head every time Tbird is updated?
What can I do to help ?

Thunderbird 38.5.1
Ubuntu 14.04
xdg-utils 1.1.0~rc1-2ubuntu7.1

Revision history for this message
Bill Kelly (bk54) wrote :

I fixed this locally. The problem is in the function "desktop_file_to_binary()". "grep" on line 228 is returning 3 matches. It needs to be piped to "head -n1". Without this change, "which" on the next line is returning "", and "run_thunderbird" is not executed by the calling function.

Revision history for this message
Bill Kelly (bk54) wrote :
Revision history for this message
Amr Ibrahim (amribrahim1987) wrote :

Guys, I opened LP: #1540399 for this bug. Please write your comments and patches their because this one is closed.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.