Description: I get err message "Type: com.sun.star.lang.IllegalArgumentException Message: Invalid attachment file URL." on line" eMailClient.sendSimpleMailMessage( eMessage, nFlag)" I cant attache screenshot the script works correctly in LO 6.1.X REM ***** BASIC ***** Sub Main End Sub Sub SendMail 'this is solution for button (variables in czech language) doc = thisComponent list = doc.getCurrentController.getActiveSheet adresa = list.GetCellRangeByName("A1").string predmet = list.GetCellRangeByName("A2").string telo = list.GetCellRangeByName("A3").string priloha = list.GetCellRangeByName("A4").string Mailer (adresa, predmet, telo, priloha) end sub Sub HyperSendMail (sURL$) 'this is solution for function HYPERLINK in the sheet (variables in czech language) adresa = getArgumentFromURL(sURL,"MailAddress") predmet = getArgumentFromURL(sURL, "Subject") telo = getArgumentFromURL(sURL, "Body") priloha = getArgumentFromURL(sURL, "Attach") Mailer (adresa, predmet, telo, priloha) End Sub Sub Mailer (eMailAddress as String, eSubject as String, eBody as String, Attachment as String) Dim eMailer as Object Dim eMailClient as Object Dim eMessage as Object Dim nFlag as integer nFlag = 0 eMailer = createUnoService( "com.sun.star.system.SimpleSystemMail" ) eMailClient = eMailer.querySimpleMailClient() eMessage = eMailClient.createSimpleMailMessage() eMessage.setRecipient(eMailAddress) eMessage.setSubject(eSubject) if Attachment <> "" Then eAttachmentURL = convertToUrl(Attachment) eMessage.setAttachement (Array(eAttachmentURL)) end if eBody = Replace(eBody,"*",chr(10)) eMessage.body = eBody eMailClient.sendSimpleMailMessage( eMessage, nFlag) End Sub REM returns "" if no value was found for name. Function getArgumentFromURL(sURL$,sName$) as String on error goto exitErr: Dim iStart%, i%, l%, sArgs$, a() iStart = instr(sURL, "?") l = len(sName) if (iStart = 0) or (l = 0) then exit function ' sArgs behind "?": sArgs = mid(sURL, iStart +1) a() = split(sArgs, "&") for i = 0 to uBound(a()) ' not case sensitive: if instr(1, a(i), sName &"=", 1) = 1 then getArgumentFromURL = mid(a(i), l +2) exit for endif next exitErr: ' return "" End Function Steps to Reproduce: 1.run script Actual Results: the script stops and write error message Expected Results: the script finish as in LO 6.1.X Reproducible: Always User Profile Reset: Yes Additional Info: [Information automatically included from LibreOffice] Locale: cs Module: SpreadsheetDocument [Information guessed from browser] OS: Windows (All) OS is 64bit: no
Created attachment 150161 [details] error screenshot
Thank you for reporting the bug. Please attach a working sample document with your macro included, as this makes it easier for us to verify the bug. (Please note that the attachment will be public, remove any sensitive information before attaching it. See https://wiki.documentfoundation.org/QA/FAQ#How_can_I_eliminate_confidential_data_from_a_sample_document.3F for help on how to do so.) I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' once the requested document is provided.
Created attachment 150215 [details] example ods file with basic error click CTRL+left mouse button on orange marked cell to get basic error
Created attachment 150235 [details] simple email demo (In reply to Libor Theimer from comment #3) > click CTRL+left mouse button on orange marked cell to get basic error if i click ctrl+left mouse button on cell BI2 nothing happens. adding a simple example, works fine with LO 6.1.5.2, 6.2.2.2 and 6.3 alpha
I wrote cell, but I meant text (link) inside the cell. I tested it before I sent ODS file to you
You have to allow run macros in Calc
now i can reproduce with: Version: 6.2.2.2 (x64) Build-ID: 2b840030fec2aae0fd2658d8d4f9548af4e3518d CPU-Threads: 4; BS: Windows 10.0; UI-Render: Standard; VCL: win; Gebietsschema: de-DE (de_DE); UI-Sprache: de-DE Calc: it was ok with: Version: 6.1.5.2 (x64) Build ID: 90f8dcf33c87b3705e78202e3df5142b201bd805 CPU threads: 4; OS: Windows 10.0; UI render: default; Locale: de-DE (de_DE); Calc: Hyperlink functions seems to partly encode the URL, e.g. from "d:\file.pdf" to "d:%5Cfile.pdf" will try to bisect
seems to have started with: https://gerrit.libreoffice.org/plugins/gitiles/core/+/e6b18c1d0f377e1295970b94bdf6b90739e13d4d commit e6b18c1d0f377e1295970b94bdf6b90739e13d4d [log] author Eike Rathke <erack@redhat.com> Wed Jul 11 15:44:18 2018 +0200 committerEike Rathke <erack@redhat.com> Wed Jul 11 18:35:28 2018 +0200 tree 367e84359dc1cb552660103e4f9eaa3851dda6d9 parent 4dfc014cb3838b61faef32991c8083787ee6d60c [diff] ScGlobal::OpenURL: support relative references as URI references in hyperlinks Instead of failing with "is not an absolute URL" error. For example in the HYPERLINK() spreadsheet function where Excel supports it, but also anywhere else that calls OpenURL(). A relative reference is relative to the current document, or for yet unsaved documents or if no object shell is available relative to the work path, as usual. Additional benefit is that "\\" UNC path names are accepted as smb:// Samba shares and DOS \ path name separators resolved for a proper file:// URI. Users are asking for this, found no related tdf# bug/RFE. See https://ask.libreoffice.org/en/question/160280/relative-and-absolute-hyperlinks/ and other linked q&a therein. /cygdrive/d/sources/bibisect/bibisect-win32-6.2 $ git bisect bad b87ef3a002af7e1ff940acc9b39963b5103d0df4 is the first bad commit commit b87ef3a002af7e1ff940acc9b39963b5103d0df4 Author: Norbert Thiebaud <nthiebaud@gmail.com> Date: Sun Jul 22 21:57:51 2018 -0700 source e6b18c1d0f377e1295970b94bdf6b90739e13d4d source e6b18c1d0f377e1295970b94bdf6b90739e13d4d :040000 040000 ebc7b17df09e864a57014aeaceec6357ebb6ca2c 1e81052b10b9e56277208c22b663adb2ee1d443f M instdir /cygdrive/d/sources/bibisect/bibisect-win32-6.2 $ git bisect log # bad: [d60ae8383378fcecc7ab077670bf45208a214c71] source e45c30858dec1dd705b9144fab981a3c8819ba96 # good: [b0a56ec98b1368cb5e3e531e0b3f69565af91609] source 3a801799536e6870f2fb111b1cc00b9575a35a39 git bisect start 'master' 'oldest' # bad: [5180a3b7a5dc530ad7ec5bd6e5cefecf85beab7e] source 8bcc4a98d78869d6839821b9747602777f00ebaf git bisect bad 5180a3b7a5dc530ad7ec5bd6e5cefecf85beab7e # bad: [5180a3b7a5dc530ad7ec5bd6e5cefecf85beab7e] source 8bcc4a98d78869d6839821b9747602777f00ebaf git bisect bad 5180a3b7a5dc530ad7ec5bd6e5cefecf85beab7e # bad: [5180a3b7a5dc530ad7ec5bd6e5cefecf85beab7e] source 8bcc4a98d78869d6839821b9747602777f00ebaf git bisect bad 5180a3b7a5dc530ad7ec5bd6e5cefecf85beab7e # good: [c0ac0d5f5cb9fff4196b80799bd6629b5ad0d33e] source eedeeb63d1287ed0416e1fe3d2f7ba37632626d0 git bisect good c0ac0d5f5cb9fff4196b80799bd6629b5ad0d33e # bad: [b4af3139f0a15dfdcdc1d96f4eeb861784648ccc] source 03d98b69a3ea1150884bab90c826dd9eb8382283 git bisect bad b4af3139f0a15dfdcdc1d96f4eeb861784648ccc # bad: [e62cc3ba51153a8efb05d73ebc9a726b8aa0c237] source a3d4eb94937822a118ab93ad8f4c82a2c8f8bb34 git bisect bad e62cc3ba51153a8efb05d73ebc9a726b8aa0c237 # bad: [96dc36662410655365a13a8d716deecd8f4476cd] source 6df45ae3a85b21d984605a6656282e5feaf8dea9 git bisect bad 96dc36662410655365a13a8d716deecd8f4476cd # good: [7390d982c015e311dfd4549610c3dffa994aa955] source 4dfc014cb3838b61faef32991c8083787ee6d60c git bisect good 7390d982c015e311dfd4549610c3dffa994aa955 # bad: [02d6139603858e614904c4577b390f2627e5149e] source 281f1281edbd0063b1d1d9151bcbfc1299a0082e git bisect bad 02d6139603858e614904c4577b390f2627e5149e # bad: [4e765ea226f970a570291efee0cbb0259af8db0f] source 0132f27d4e062b9306e4fb90c38a58afffbe6cf0 git bisect bad 4e765ea226f970a570291efee0cbb0259af8db0f # bad: [5069cd477b3d31cb6749e92472e1548cca309462] source 9a238644f21014cef085b7124ebc3d1397e85870 git bisect bad 5069cd477b3d31cb6749e92472e1548cca309462 # bad: [3f15178caa245f08fa65e4ca1ed53832cbeb20eb] source 537ca51ddb2ad2052cb0ca33fd8656d42ad46733 git bisect bad 3f15178caa245f08fa65e4ca1ed53832cbeb20eb # bad: [9a2ee772a9d7060e74aad6e6c586288a2ffbdd26] source 3ffd06f141f86a695deb8672a34b95f31f4d1b16 git bisect bad 9a2ee772a9d7060e74aad6e6c586288a2ffbdd26 # bad: [34cea8bb16c02a8be9eb75b37ec03d4e0a2dbe10] source 0613ce41da0b94bc481b94b8141afcf15df8abe7 git bisect bad 34cea8bb16c02a8be9eb75b37ec03d4e0a2dbe10 # bad: [b87ef3a002af7e1ff940acc9b39963b5103d0df4] source e6b18c1d0f377e1295970b94bdf6b90739e13d4d git bisect bad b87ef3a002af7e1ff940acc9b39963b5103d0df4 # first bad commit: [b87ef3a002af7e1ff940acc9b39963b5103d0df4] source e6b18c1d0f377e1295970b94bdf6b90739e13d4d
First off, d:\file.pdf is not an URL, it probably would work if that was file:///d|file.pdf instead. Anyhow, could try to rule out the intruding encoding there and keep any d:\... Windows specific path specifier and treat it like an absolute URL (however that's accepted later).
(In reply to Eike Rathke from comment #9) > First off, d:\file.pdf is not an URL, it probably would work if that was > file:///d|file.pdf instead. correct, even "d:/file.pdf" will work btw: the hyperlink() function now encodes all arguments, e.g.: Dear%20Ms.%20/%20Mr.,%0Ablablabla%0A%0ABest%20regards so one has to decode it with a basic function.
Ok I previously misunderstood from the initial description that d:\file.pdf would be an URI to open, but this is all passed as arguments in a vnd.sun.star.script: "URI" to be opened, which changes things. We need some exemptions for this and others.
Btw, using valid domains (even with non-existing accounts) for email addresses in test code isn't such a good idea, better use example.com or example.org that are exactly made for this and ignore all mail sent to them.
Eike Rathke committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/+/ca08ec9292410c28713fd2d92920a7af09883e97%5E%21 Resolves: tdf#124251 do not treat internal "URI" as real path URI It will be available in 6.4.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Pending review https://gerrit.libreoffice.org/74069 for 6-3 https://gerrit.libreoffice.org/74070 for 6-2 https://gerrit.libreoffice.org/74071 for 6-2-5
Eike Rathke committed a patch related to this issue. It has been pushed to "libreoffice-6-3": https://git.libreoffice.org/core/+/e2f7211e9ef70ef9696175e9447edc3e779b3cc6%5E%21 Resolves: tdf#124251 do not treat internal "URI" as real path URI It will be available in 6.3.0.1. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Eike Rathke committed a patch related to this issue. It has been pushed to "libreoffice-6-2": https://git.libreoffice.org/core/+/ed9cb51dfddf066b0b19681e86c42121aa9cce9c%5E%21 Resolves: tdf#124251 do not treat internal "URI" as real path URI It will be available in 6.2.6. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Eike Rathke committed a patch related to this issue. It has been pushed to "libreoffice-6-2-5": https://git.libreoffice.org/core/+/9f3df50d4ff94ebe16108a9a81dda26f252ff071%5E%21 Resolves: tdf#124251 do not treat internal "URI" as real path URI It will be available in 6.2.5. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
@Oliver Brinzing, could you please verify the issue is fixed in master ?
(In reply to Xisco Faulí from comment #18) > @Oliver Brinzing, could you please verify the issue is fixed in master ? with attachment https://bugs.documentfoundation.org/attachment.cgi?id=150215 and LO 6.2.5.1 i still get basic error: > file:///d:%5Cfile.pdf > Type: com.sun.star.lang.IllegalArgumentException > Message: Invalid attachment file URL. but with current master/LO 6.2.6 Build the macro seems to work, url is now: file:///d:/test.pdf
(In reply to Oliver Brinzing from comment #19) > (In reply to Xisco Faulí from comment #18) > > @Oliver Brinzing, could you please verify the issue is fixed in master ? > > with attachment https://bugs.documentfoundation.org/attachment.cgi?id=150215 > and LO 6.2.5.1 i still get basic error: > > > file:///d:%5Cfile.pdf > > Type: com.sun.star.lang.IllegalArgumentException > > Message: Invalid attachment file URL. > > but with current master/LO 6.2.6 Build the macro seems to work, > url is now: file:///d:/test.pdf Hi Oliver, Thanks for checking. Setting to VERIFIED then.