[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-4-0' - 2 commits - loleaflet/html loleaflet/src test/data test/UnitWOPI.cpp wsd/ClientSession.cpp wsd/FileServer.cpp
Ashod Nakashian (via logerrit)
logerrit at kemper.freedesktop.org
Mon Nov 25 14:13:56 UTC 2019
loleaflet/html/framed.doc.html | 5 +++--
loleaflet/src/map/handler/Map.WOPI.js | 1 +
test/UnitWOPI.cpp | 10 +++++++++-
test/data/empty.odt |binary
wsd/ClientSession.cpp | 5 +++++
wsd/FileServer.cpp | 5 +++--
6 files changed, 21 insertions(+), 5 deletions(-)
New commits:
commit bc2fbb24ce4c84e44ae156ff207cc62f95bea302
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sun Nov 17 08:46:05 2019 -0500
Commit: Michael Meeks <michael.meeks at collabora.com>
CommitDate: Mon Nov 25 15:13:44 2019 +0100
test: validate ExtendedData sent to WOPI
(cherry picked from commit 4bad59f6bf4c6a92933cf5d01b8086df76653376)
Change-Id: Ib5da41e7f1ca7547ea6ac43daefa4b0259ba4c41
Reviewed-on: https://gerrit.libreoffice.org/83049
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
diff --git a/test/UnitWOPI.cpp b/test/UnitWOPI.cpp
index 3e1542d9b..8756f7bb9 100644
--- a/test/UnitWOPI.cpp
+++ b/test/UnitWOPI.cpp
@@ -70,6 +70,10 @@ public:
// and this test fakes that it's an autosave
CPPUNIT_ASSERT_EQUAL(std::string("true"), request.get("X-LOOL-WOPI-IsAutosave"));
+ // Check that we get the extended data.
+ CPPUNIT_ASSERT_EQUAL(std::string("CustomFlag=Custom Value;AnotherFlag=AnotherValue"),
+ request.get("X-LOOL-WOPI-ExtendedData"));
+
_finishedSaveModified = true;
}
@@ -105,7 +109,11 @@ public:
}
case Phase::SaveModified:
{
- helpers::sendTextFrame(*_ws->getLOOLWebSocket(), "save dontTerminateEdit=0 dontSaveIfUnmodified=0", testName);
+ helpers::sendTextFrame(*_ws->getLOOLWebSocket(),
+ "save dontTerminateEdit=0 dontSaveIfUnmodified=0 "
+ "extendedData=CustomFlag%3DCustom%20Value%3BAnotherFlag%"
+ "3DAnotherValue",
+ testName);
_phase = Phase::Polling;
_savingPhase = SavingPhase::Modified;
commit 89b776e2208b1982985154296cc5bbe77c021989
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Nov 16 11:59:39 2019 -0500
Commit: Michael Meeks <michael.meeks at collabora.com>
CommitDate: Mon Nov 25 15:13:35 2019 +0100
Encode the ExtendedData to make it safer while embedding in messages
(cherry picked from commit ddfe37623667af720486ffd70404fc5a12983718)
Change-Id: I1d4bdb2775d89e9a52a96d833228ca8577ee3561
Reviewed-on: https://gerrit.libreoffice.org/83048
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
diff --git a/loleaflet/html/framed.doc.html b/loleaflet/html/framed.doc.html
index 55e73ab37..26516ff76 100644
--- a/loleaflet/html/framed.doc.html
+++ b/loleaflet/html/framed.doc.html
@@ -48,7 +48,7 @@
function save() {
post({'MessageId': 'Action_Save',
- 'Values': { 'Notify': true, 'ExtendedData': 'CustomFlag=CustomValue;AnotherFlag=AnotherValue' }
+ 'Values': { 'Notify': true, 'ExtendedData': 'CustomFlag=Custom Value;AnotherFlag=AnotherValue' }
});
}
@@ -90,9 +90,10 @@
<body style="user-select: none;">
+ <p>Note: Set net/frame_ancestors in loolwsd.xml to contain 'file:' (without the quotes, but with the colon), otherwise you will get CSP violation. And force reload, or clear caches, otherwise you might get served from the browser cache..</p>
<form id="insert-text-form">
Click <button onclick="insertText(document.forms['insert-text-form'].elements['source'].value); return false;">here</button> to insert the following text into the document:
- <textarea name="source" value="" rows="10" cols="80"></textarea>
+ <textarea name="source" value="" rows="5" cols="50"></textarea>
</form>
<form id="insert-text-form">
diff --git a/loleaflet/src/map/handler/Map.WOPI.js b/loleaflet/src/map/handler/Map.WOPI.js
index 43f2f2205..fad51c6b3 100644
--- a/loleaflet/src/map/handler/Map.WOPI.js
+++ b/loleaflet/src/map/handler/Map.WOPI.js
@@ -269,6 +269,7 @@ L.Map.WOPI = L.Handler.extend({
var dontTerminateEdit = msg.Values && msg.Values['DontTerminateEdit'];
var dontSaveIfUnmodified = msg.Values && msg.Values['DontSaveIfUnmodified'];
var extendedData = msg.Values && msg.Values['ExtendedData'];
+ extendedData = encodeURIComponent(extendedData);
this._notifySave = msg.Values && msg.Values['Notify'];
this._map.save(dontTerminateEdit, dontSaveIfUnmodified, extendedData);
diff --git a/test/data/empty.odt b/test/data/empty.odt
index 6b0747507..fd744ab0f 100644
Binary files a/test/data/empty.odt and b/test/data/empty.odt differ
diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp
index 1279cb3ae..c83d3abb2 100644
--- a/wsd/ClientSession.cpp
+++ b/wsd/ClientSession.cpp
@@ -278,7 +278,12 @@ bool ClientSession::_handleInput(const char *buffer, int length)
std::string extendedData;
if (tokens.size() > 3)
+ {
getTokenString(tokens[3], "extendedData", extendedData);
+ std::string decoded;
+ Poco::URI::decode(extendedData, decoded);
+ extendedData = decoded;
+ }
constexpr bool isAutosave = false;
constexpr bool isExitSave = false;
diff --git a/wsd/FileServer.cpp b/wsd/FileServer.cpp
index 25b00c325..6fb0c4767 100644
--- a/wsd/FileServer.cpp
+++ b/wsd/FileServer.cpp
@@ -276,7 +276,7 @@ void FileServerRequestHandler::handleRequest(const HTTPRequest& request, Poco::M
std::string path(requestUri.getPath());
if (path.find("loleaflet/" LOOLWSD_VERSION_HASH "/") == std::string::npos)
{
- LOG_WRN("client - server version mismatch, disabling browser cache.");
+ LOG_WRN("client - server version mismatch, disabling browser cache. Expected: " LOOLWSD_VERSION_HASH);
noCache = true;
}
@@ -803,7 +803,8 @@ void FileServerRequestHandler::preprocessFile(const HTTPRequest& request, Poco::
oss << "\r\n"
<< preprocess;
- socket->send(oss.str());
+ preprocess = oss.str();
+ socket->send(preprocess);
LOG_DBG("Sent file: " << relPath << ": " << preprocess);
}
More information about the Libreoffice-commits
mailing list