kit/ChildSession.cpp | 2 +- test/UnitWOPITemplate.cpp | 12 ++++++------ test/WopiTestServer.hpp | 2 ++ 3 files changed, 9 insertions(+), 7 deletions(-)
New commits: commit 393db38ce28573aaa6644948e7521b7c78045ee6 Author: Henry Castro <[email protected]> AuthorDate: Mon May 27 12:07:00 2019 -0400 Commit: Jan Holesovsky <[email protected]> CommitDate: Thu Jul 25 07:59:24 2019 +0200 kit: take ownership when saving a document template Otherwise, it causes error log: ERR Cannot save docKey [/filename], the .uno:Save has failed in LOK. Change-Id: Ic99807848def72f76471c4f999ebeed9a7c0a2c8 diff --git a/kit/ChildSession.cpp b/kit/ChildSession.cpp index a229ae5f0..b3ee31b0a 100644 --- a/kit/ChildSession.cpp +++ b/kit/ChildSession.cpp @@ -569,7 +569,7 @@ bool ChildSession::loadDocument(const char * /*buffer*/, int /*length*/, const s if (!doctemplate.empty()) { std::string url = getJailedFilePath(); - bool success = getLOKitDocument()->saveAs(url.c_str(), nullptr, nullptr); + bool success = getLOKitDocument()->saveAs(url.c_str(), nullptr, "TakeOwnership"); if (!success) { LOG_ERR("Failed to save template [" << getJailedFilePath() << "]."); commit 635f0627f2ff27b6a5962e35b7bf26f9782b2110 Author: Jan Holesovsky <[email protected]> AuthorDate: Thu Jul 25 07:58:19 2019 +0200 Commit: Jan Holesovsky <[email protected]> CommitDate: Thu Jul 25 07:58:19 2019 +0200 Fix build. Change-Id: I3e7dc00a8acdaf0ad1a07c0cd55ff7bff7b64295 diff --git a/test/UnitWOPITemplate.cpp b/test/UnitWOPITemplate.cpp index 1ab588799..9416ea3cc 100644 --- a/test/UnitWOPITemplate.cpp +++ b/test/UnitWOPITemplate.cpp @@ -47,14 +47,14 @@ public: Poco::JSON::Object::Ptr fileInfo = new Poco::JSON::Object(); fileInfo->set("BaseFileName", "test.odt"); fileInfo->set("TemplateSource", std::string("http://127.0.0.1:") + std::to_string(helpers::getClientPort()) + "/test.ott"); // must be http, otherwise Neon in the core complains - fileInfo->set("Size", _fileContent.size()); + fileInfo->set("Size", getFileContent().size()); fileInfo->set("Version", "1.0"); fileInfo->set("OwnerId", "test"); fileInfo->set("UserId", "test"); fileInfo->set("UserFriendlyName", "test"); fileInfo->set("UserCanWrite", "true"); fileInfo->set("PostMessageOrigin", "localhost"); - fileInfo->set("LastModifiedTime", Poco::DateTimeFormatter::format(Poco::DateTime(_fileLastModifiedTime), Poco::DateTimeFormat::ISO8601_FRAC_FORMAT)); + fileInfo->set("LastModifiedTime", Poco::DateTimeFormatter::format(Poco::DateTime(getFileLastModifiedTime()), Poco::DateTimeFormat::ISO8601_FRAC_FORMAT)); fileInfo->set("EnableOwnerTermination", "true"); std::ostringstream jsonStream; @@ -65,7 +65,7 @@ public: std::ostringstream oss; oss << "HTTP/1.1 200 OK\r\n" - << "Last-Modified: " << Poco::DateTimeFormatter::format(_fileLastModifiedTime, Poco::DateTimeFormat::HTTP_FORMAT) << "\r\n" + << "Last-Modified: " << Poco::DateTimeFormatter::format(getFileLastModifiedTime(), Poco::DateTimeFormat::HTTP_FORMAT) << "\r\n" << "User-Agent: " << WOPI_AGENT_STRING << "\r\n" << "Content-Length: " << responseString.size() << "\r\n" << "Content-Type: " << mimeType << "\r\n" @@ -113,7 +113,7 @@ public: oss << "HTTP/1.1 200 OK\r\n" << "User-Agent: " << WOPI_AGENT_STRING << "\r\n" << "\r\n" - << "{\"LastModifiedTime\": \"" << Poco::DateTimeFormatter::format(_fileLastModifiedTime, Poco::DateTimeFormat::ISO8601_FRAC_FORMAT) << "\" }"; + << "{\"LastModifiedTime\": \"" << Poco::DateTimeFormatter::format(getFileLastModifiedTime(), Poco::DateTimeFormat::ISO8601_FRAC_FORMAT) << "\" }"; socket->send(oss.str()); socket->shutdown(); @@ -139,7 +139,7 @@ public: { initWebsocket("/wopi/files/10?access_token=anything"); - helpers::sendTextFrame(*_ws->getLOOLWebSocket(), "load url=" + _wopiSrc, testName); + helpers::sendTextFrame(*getWs()->getLOOLWebSocket(), "load url=" + getWopiSrc(), testName); SocketPoll::wakeupWorld(); _phase = Phase::SaveDoc; @@ -147,7 +147,7 @@ public: } case Phase::CloseDoc: { - helpers::sendTextFrame(*_ws->getLOOLWebSocket(), "closedocument", testName); + helpers::sendTextFrame(*getWs()->getLOOLWebSocket(), "closedocument", testName); _phase = Phase::Polling; break; } diff --git a/test/WopiTestServer.hpp b/test/WopiTestServer.hpp index 5d64e7911..d3533bc34 100644 --- a/test/WopiTestServer.hpp +++ b/test/WopiTestServer.hpp @@ -57,6 +57,8 @@ protected: _fileLastModifiedTime = Poco::Timestamp(); } + const Poco::Timestamp& getFileLastModifiedTime() const { return _fileLastModifiedTime; } + public: WopiTestServer(std::string fileContent = "Hello, world") : _fileContent(std::move(fileContent)) _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
