Kaydet (Commit) f6dc5636 authored tarafından Tamás Zolnai's avatar Tamás Zolnai

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: 's avatarTamás Zolnai <tamas.zolnai@collabora.com>
üst 8b1ab55b
...@@ -113,7 +113,7 @@ void Test::testTdf100837() { ...@@ -113,7 +113,7 @@ void Test::testTdf100837() {
{ {
// 3. Test enocded URLs // 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); desktop::CommandLineArgs args(supplier);
auto vOpenList = args.GetOpenList(); auto vOpenList = args.GetOpenList();
auto vForceOpenList = args.GetForceOpenList(); auto vForceOpenList = args.GetForceOpenList();
......
...@@ -131,25 +131,25 @@ CommandLineEvent CheckOfficeURI(/* in,out */ OUString& arg, CommandLineEvent cur ...@@ -131,25 +131,25 @@ CommandLineEvent CheckOfficeURI(/* in,out */ OUString& arg, CommandLineEvent cur
long nURIlen = -1; long nURIlen = -1;
// URL might be encoded // 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) // 2. Discriminate by command name (incl. 1st command argument descriptor)
// Extract URI: everything up to possible next argument // 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 // Open for view - override only in default mode
if (curEvt == CommandLineEvent::Open) if (curEvt == CommandLineEvent::Open)
curEvt = CommandLineEvent::View; curEvt = CommandLineEvent::View;
nURIlen = rest2.indexOf("|"); 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 // Open for editing - override only in default mode
if (curEvt == CommandLineEvent::Open) if (curEvt == CommandLineEvent::Open)
curEvt = CommandLineEvent::ForceOpen; curEvt = CommandLineEvent::ForceOpen;
nURIlen = rest2.indexOf("|"); 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 // New from template - override only in default mode
if (curEvt == CommandLineEvent::Open) if (curEvt == CommandLineEvent::Open)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment