From 194c8298c43a8c9321f591ecf7e992bb6c7390b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Wed, 16 Sep 2026 12:45:42 +0000 Subject: [PATCH] senddoc: pass the mail client its arguments directly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit so the generic-mailto and xdg-email branch calls the mail client with each attachment path as one argument, as the other branches already do Signed-off-by: Caolán McNamara Change-Id: Id3fba77ebcb7bb10ef6116c311390a0bdeb412ce Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/12783 Tested-by: Jenkins CPCI Reviewed-by: Noel Grandin Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/12845 Reviewed-by: Miklos Vajna (cherry picked from commit 0d6a67a081caf933eedb28701079f6576aa3700f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211798 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- shell/source/unix/misc/senddoc.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/shell/source/unix/misc/senddoc.sh b/shell/source/unix/misc/senddoc.sh index 65ade8426d1f..dd2ee8144d54 100755 --- a/shell/source/unix/misc/senddoc.sh +++ b/shell/source/unix/misc/senddoc.sh @@ -277,7 +277,11 @@ case $MAILER_TYPE in generic-mailto | xdg-email) - while [ "$1" != "" ]; do + # The loop shifts options off the front of "$@" while the mail client's arguments are + # appended to the back. The marker separates the two. + set -- "$@" "--end-of-arguments" + + while [ "$1" != "--end-of-arguments" ]; do case $1 in --to) if [ "${TO}" != "" ]; then @@ -309,7 +313,7 @@ case $MAILER_TYPE in MAILTO="${MAILTO:+${MAILTO}&}attach=${ATTACH_URL}&attachment=${ATTACH_URL}" if [ "$MAILER_TYPE" = "xdg-email" ]; then # Also add the argument: see https://gitlab.freedesktop.org/xdg/xdg-utils/-/issues/177 - ATTACH="${ATTACH:+${ATTACH} }--attach \"$2\"" + set -- "$@" --attach "$2" fi shift ;; @@ -318,9 +322,10 @@ case $MAILER_TYPE in esac shift; done + shift MAILTO="mailto:${TO}?${MAILTO}" - eval "${MAILER} ${ATTACH} \"${MAILTO}\"" & + ${MAILER} "$@" "${MAILTO}" & ;; dtmail)