https://bugs.documentfoundation.org/show_bug.cgi?id=172966

--- Comment #7 from [email protected] ---
I can reproduce this on Kubuntu 26.04 (KDE Plasma 6.6, Wayland) with
LibreOffice 26.2.6.3, xdg-utils 1.2.1 and Thunderbird 157 (Mozilla deb), and
I think the duplication happens in senddoc, not in the C++ code (which matches
comment 6: aFileName / aAttachmentSeq are correct).

Since commit "Send attachments to xdg-email also as --attach arguments"
(Mike Kaganski, Dec 2024, https://gerrit.libreoffice.org/c/core/+/178701,
i.e. LO 25.2 - which fits "works in 24.8"), the xdg-email branch of senddoc
passes every attachment twice:

  --attach)
      ATTACH_URL=$(printf file://%s "$2" | "${URI_ENCODE}")
     
MAILTO="${MAILTO:+${MAILTO}&}attach=${ATTACH_URL}&attachment=${ATTACH_URL}"
      if [ "$MAILER_TYPE" = "xdg-email" ]; then
          ATTACH="${ATTACH:+${ATTACH} }--attach \"$2\""
      fi

xdg-email then adds the --attach file as another attach= entry. When the
user's mail client is Thunderbird, xdg-email's run_thunderbird() (used by
open_kde, open_gnome, open_gnome3, open_lxqt and open_generic) collects all
attach= entries and joins them with a comma. Running senddoc with a stub
"thunderbird" that only prints its arguments shows:

  /usr/lib/libreoffice/program/senddoc --subject "test.odt" --attach
"/tmp/lu…/test.odt"
  -> thunderbird -compose
"subject=test.odt,attachment='file:///tmp/lu…/test.odt,/tmp/lu…/test.odt'"

i.e. the same file twice, once as a file:// URL and once as a plain path.
Recent Thunderbird (after the comma-in-filename change, Mozilla bug 900117,
TB 148) apparently no longer splits this list and reports the whole string as
one missing file ("…/test.odt%2C/tmp/…/test.odt does not exist"). Older
Thunderbird (e.g. 140 ESR in comment 1) presumably split it, which would
explain why it was not reproducible there.

Suggested fix: for MAILER_TYPE=xdg-email, pass attachments only via --attach
and do not add attach=/attachment= to the mailto URI (as proposed in
tdf#162632).

Workaround: set Tools > Options > Internet > E-mail to /usr/bin/thunderbird, so
senddoc uses "thunderbird -compose attachment='…'" with a single entry.
(On Ubuntu this additionally needs an AppArmor rule, because the
libreoffice-senddoc profile only allows xdg-email/xdg-open.)

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to