shell/source/win32/simplemail/smplmailclient.cxx |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 9cef4bd3795d9f98a00baaf06005a7b3ac064517
Author:     Mike Kaganski <[email protected]>
AuthorDate: Mon Jun 27 10:24:28 2022 +0300
Commit:     Xisco Fauli <[email protected]>
CommitDate: Wed Jun 29 10:07:56 2022 +0200

    tdf#126263: make sure to convert system path to file URLs
    
    Change-Id: Ia21f29e3a1eb078a7df2366399c59d46ab26ff3a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136482
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <[email protected]>
    Signed-off-by: Xisco Fauli <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136490
    Signed-off-by: Xisco Fauli <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136505

diff --git a/shell/source/win32/simplemail/smplmailclient.cxx 
b/shell/source/win32/simplemail/smplmailclient.cxx
index 1396bd150066..4b19880d6cc2 100644
--- a/shell/source/win32/simplemail/smplmailclient.cxx
+++ b/shell/source/win32/simplemail/smplmailclient.cxx
@@ -194,7 +194,11 @@ OUString CSmplMailClient::CopyAttachment(const OUString& 
sOrigAttachURL, OUStrin
     maAttachmentFiles.back()->EnableKillingFile();
     INetURLObject aFilePathObj(maAttachmentFiles.back()->GetURL());
     OUString sNewAttachmentURL = 
aFilePathObj.GetMainURL(INetURLObject::DecodeMechanism::NONE);
-    if (osl::File::copy(sOrigAttachURL, sNewAttachmentURL) == 
osl::FileBase::RC::E_None)
+    OUString sCorrectedOrigAttachURL(sOrigAttachURL);
+    // Make sure to convert to URL, if a system path was passed to 
XSimpleMailMessage
+    // Ignore conversion error, in which case sCorrectedOrigAttachURL is 
unchanged
+    osl::FileBase::getFileURLFromSystemPath(sCorrectedOrigAttachURL, 
sCorrectedOrigAttachURL);
+    if (osl::File::copy(sCorrectedOrigAttachURL, sNewAttachmentURL) == 
osl::FileBase::RC::E_None)
     {
         INetURLObject url(sOrigAttachURL, 
INetURLObject::EncodeMechanism::WasEncoded);
         sUserVisibleName = url.getName(INetURLObject::LAST_SEGMENT, true,

Reply via email to