[Libreoffice-commits] core.git: desktop/qa desktop/source
Tamás Zolnai (via logerrit)
logerrit at kemper.freedesktop.org
Tue Apr 16 20:01:31 UTC 2019
desktop/qa/desktop_app/test_desktop_app.cxx | 23 +++++++++++++++++++++++
desktop/source/app/cmdlineargs.cxx | 4 ++++
2 files changed, 27 insertions(+)
New commits:
commit 2317ad572cc330c4c2de95065ef275f58a9c83a1
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Tue Apr 16 10:45:12 2019 +0200
Commit: Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Tue Apr 16 22:00:48 2019 +0200
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>
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 52f96dd84d88..acb266eb335e
--- a/desktop/source/app/cmdlineargs.cxx
+++ b/desktop/source/app/cmdlineargs.cxx
@@ -129,6 +129,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