[Libreoffice-commits] core.git: Branch 'distro/cib/libreoffice-6-1' - 2 commits - desktop/qa desktop/source

Tamás Zolnai (via logerrit) logerrit at kemper.freedesktop.org
Sun Nov 3 23:53:11 UTC 2019


 desktop/qa/desktop_app/test_desktop_app.cxx |   23 +++++++++++++++++++++++
 desktop/source/app/cmdlineargs.cxx          |   10 +++++++---
 2 files changed, 30 insertions(+), 3 deletions(-)

New commits:
commit b73ddeb016d3d7790565dd7870b0e18e678fe24b
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Wed Apr 17 12:33:13 2019 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Mon Nov 4 00:51:52 2019 +0100

    SharePoint connection: Better handling of encoded URLs
    
    Handle %7c with small letters.
    Make sure that the output parameter's content is not
    affected by decoding.
    
    Change-Id: Ie3faad2461815497c0edfb04a589fc57aeb7d66b
    Reviewed-on: https://gerrit.libreoffice.org/70873
    Tested-by: Jenkins
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
    (cherry picked from commit f6dc5636c1eda8aebeac3f7b85dd61499523d6a3)

diff --git a/desktop/qa/desktop_app/test_desktop_app.cxx b/desktop/qa/desktop_app/test_desktop_app.cxx
index 055c8cf5434e..1a027dfade78 100644
--- a/desktop/qa/desktop_app/test_desktop_app.cxx
+++ b/desktop/qa/desktop_app/test_desktop_app.cxx
@@ -113,7 +113,7 @@ void Test::testTdf100837() {
 
     {
         // 3. Test enocded URLs
-        TestSupplier supplier{ "foo", "ms-word:ofe%7Cu%7Cbar1", "ms-word:ofv%7Cu%7Cbar2", "ms-word:nft%7Cu%7Cbar3", "baz" };
+        TestSupplier supplier{ "foo", "ms-word:ofe%7Cu%7cbar1", "ms-word:ofv%7cu%7Cbar2", "ms-word:nft%7Cu%7cbar3", "baz" };
         desktop::CommandLineArgs args(supplier);
         auto vOpenList = args.GetOpenList();
         auto vForceOpenList = args.GetForceOpenList();
diff --git a/desktop/source/app/cmdlineargs.cxx b/desktop/source/app/cmdlineargs.cxx
old mode 100755
new mode 100644
index 00b5c88ee05e..8fe83f523c48
--- a/desktop/source/app/cmdlineargs.cxx
+++ b/desktop/source/app/cmdlineargs.cxx
@@ -129,25 +129,25 @@ CommandLineEvent CheckOfficeURI(/* in,out */ OUString& arg, CommandLineEvent cur
     long nURIlen = -1;
 
     // URL might be encoded
-    rest1 = rest1.replaceAll("%7C", "|");
+    OUString decoded_rest = rest1.replaceAll("%7C", "|").replaceAll("%7c", "|");
 
     // 2. Discriminate by command name (incl. 1st command argument descriptor)
     //    Extract URI: everything up to possible next argument
-    if (rest1.startsWith("ofv|u|", &rest2))
+    if (decoded_rest.startsWith("ofv|u|", &rest2))
     {
         // Open for view - override only in default mode
         if (curEvt == CommandLineEvent::Open)
             curEvt = CommandLineEvent::View;
         nURIlen = rest2.indexOf("|");
     }
-    else if (rest1.startsWith("ofe|u|", &rest2))
+    else if (decoded_rest.startsWith("ofe|u|", &rest2))
     {
         // Open for editing - override only in default mode
         if (curEvt == CommandLineEvent::Open)
             curEvt = CommandLineEvent::ForceOpen;
         nURIlen = rest2.indexOf("|");
     }
-    else if (rest1.startsWith("nft|u|", &rest2))
+    else if (decoded_rest.startsWith("nft|u|", &rest2))
     {
         // New from template - override only in default mode
         if (curEvt == CommandLineEvent::Open)
commit 1bfcd216382750aeb5d88b0ad80b56501b7c6d99
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Tue Apr 16 10:45:12 2019 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Mon Nov 4 00:51:44 2019 +0100

    SharePoint connection: Handle encoded URL passed as command line argument
    
    Change-Id: I3352bf9ade88bd86f7ca3d53238364216547d52b
    Reviewed-on: https://gerrit.libreoffice.org/70830
    Tested-by: Jenkins
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
    (cherry picked from commit 2317ad572cc330c4c2de95065ef275f58a9c83a1)

diff --git a/desktop/qa/desktop_app/test_desktop_app.cxx b/desktop/qa/desktop_app/test_desktop_app.cxx
index ef588a580266..055c8cf5434e 100644
--- a/desktop/qa/desktop_app/test_desktop_app.cxx
+++ b/desktop/qa/desktop_app/test_desktop_app.cxx
@@ -110,6 +110,29 @@ void Test::testTdf100837() {
         CPPUNIT_ASSERT_EQUAL(OUString("bar"),  vForceOpenList[0]);
         CPPUNIT_ASSERT_EQUAL(OUString("baz"), vForceOpenList[1]);
     }
+
+    {
+        // 3. Test enocded URLs
+        TestSupplier supplier{ "foo", "ms-word:ofe%7Cu%7Cbar1", "ms-word:ofv%7Cu%7Cbar2", "ms-word:nft%7Cu%7Cbar3", "baz" };
+        desktop::CommandLineArgs args(supplier);
+        auto vOpenList = args.GetOpenList();
+        auto vForceOpenList = args.GetForceOpenList();
+        auto vViewList = args.GetViewList();
+        auto vForceNewList = args.GetForceNewList();
+        // 2 documents go to Open list: foo; baz
+        CPPUNIT_ASSERT_EQUAL(decltype(vOpenList.size())(2), vOpenList.size());
+        CPPUNIT_ASSERT_EQUAL(OUString("foo"), vOpenList[0]);
+        CPPUNIT_ASSERT_EQUAL(OUString("baz"), vOpenList[1]);
+        // 1 document goes to ForceOpen list: bar1
+        CPPUNIT_ASSERT_EQUAL(decltype(vForceOpenList.size())(1), vForceOpenList.size());
+        CPPUNIT_ASSERT_EQUAL(OUString("bar1"), vForceOpenList[0]);
+        // 1 document goes to View list: bar2
+        CPPUNIT_ASSERT_EQUAL(decltype(vViewList.size())(1), vViewList.size());
+        CPPUNIT_ASSERT_EQUAL(OUString("bar2"), vViewList[0]);
+        // 1 document goes to ForceNew list: bar3
+        CPPUNIT_ASSERT_EQUAL(decltype(vForceNewList.size())(1), vForceNewList.size());
+        CPPUNIT_ASSERT_EQUAL(OUString("bar3"), vForceNewList[0]);
+    }
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
diff --git a/desktop/source/app/cmdlineargs.cxx b/desktop/source/app/cmdlineargs.cxx
old mode 100644
new mode 100755
index 490bf183de33..00b5c88ee05e
--- a/desktop/source/app/cmdlineargs.cxx
+++ b/desktop/source/app/cmdlineargs.cxx
@@ -127,6 +127,10 @@ CommandLineEvent CheckOfficeURI(/* in,out */ OUString& arg, CommandLineEvent cur
 
     OUString rest2;
     long nURIlen = -1;
+
+    // URL might be encoded
+    rest1 = rest1.replaceAll("%7C", "|");
+
     // 2. Discriminate by command name (incl. 1st command argument descriptor)
     //    Extract URI: everything up to possible next argument
     if (rest1.startsWith("ofv|u|", &rest2))


More information about the Libreoffice-commits mailing list