summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2019-04-17 12:33:13 +0200
committerTamás Zolnai <tamas.zolnai@collabora.com>2019-04-17 23:36:58 +0200
commitf6dc5636c1eda8aebeac3f7b85dd61499523d6a3 (patch)
tree5a70b6fab30d4a8ee91cef1bf04ce10f6dab4309
parent8b1ab55b49efca270bea7aae0f538480bd5bb1e6 (diff)
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@collabora.com>
-rw-r--r--desktop/qa/desktop_app/test_desktop_app.cxx2
-rw-r--r--[-rwxr-xr-x]desktop/source/app/cmdlineargs.cxx8
2 files changed, 5 insertions, 5 deletions
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
index acb266eb335e..30d0c3f4cced 100755..100644
--- a/desktop/source/app/cmdlineargs.cxx
+++ b/desktop/source/app/cmdlineargs.cxx
@@ -131,25 +131,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)