desktop/source/app/cmdlineargs.cxx |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

New commits:
commit 8ab71daa8b1c7095a948398b7d029dda27145d70
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Thu Sep 1 17:33:51 2022 +0200
Commit:     Christian Lohmaier <lohmaier+libreoff...@googlemail.com>
CommitDate: Fri Sep 2 18:04:16 2022 +0200

    Filter out unwanted command URIs
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139225
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>
    (cherry picked from commit 27d29f7df428885865a8e2313283839b20f2a34b)
    Conflicts:
            desktop/source/app/cmdlineargs.cxx
    
    Change-Id: I0b7e5329af8cc053d14d5c60ec14fe7f364ef993
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139182
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    (cherry picked from commit da291e2960b75153f41d440a1b41961567432e8c)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139185
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Reviewed-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com>
    Tested-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com>

diff --git a/desktop/source/app/cmdlineargs.cxx 
b/desktop/source/app/cmdlineargs.cxx
index 4d5a3bb78396..93d9e8742ba8 100644
--- a/desktop/source/app/cmdlineargs.cxx
+++ b/desktop/source/app/cmdlineargs.cxx
@@ -28,6 +28,7 @@
 #include "cmdlineargs.hxx"
 #include <osl/thread.hxx>
 #include <tools/stream.hxx>
+#include <tools/urlobj.hxx>
 #include <rtl/ustring.hxx>
 #include <rtl/process.h>
 #include <comphelper/lok.hxx>
@@ -166,7 +167,14 @@ CommandLineEvent CheckOfficeURI(/* in,out */ OUString& 
arg, CommandLineEvent cur
     }
     if (nURIlen < 0)
         nURIlen = rest2.getLength();
-    arg = rest2.copy(0, nURIlen);
+    auto const uri = rest2.copy(0, nURIlen);
+    if (INetURLObject(uri).GetProtocol() == INetProtocol::Macro) {
+        // Let the "Open" machinery process the full command URI (leading to 
failure, by intention,
+        // as the "Open" machinery does not know about those command URI 
schemes):
+        curEvt = CommandLineEvent::Open;
+    } else {
+        arg = uri;
+    }
     return curEvt;
 }
 

Reply via email to