wsd/ClientSession.cpp | 6 ++++-- wsd/DocumentBroker.cpp | 11 ++++++++--- wsd/DocumentBroker.hpp | 4 ++-- wsd/LOOLWSD.cpp | 3 +++ 4 files changed, 17 insertions(+), 7 deletions(-)
New commits: commit 8325deaf2224a211243fe8c011e4afcfe17d7529 Author: Jan Holesovsky <ke...@collabora.com> AuthorDate: Tue May 5 19:38:04 2020 +0200 Commit: Jan Holesovsky <ke...@collabora.com> CommitDate: Tue May 5 22:56:55 2020 +0200 nocaps: Make the convert-to work too. And also compile out ConvertToBroker in mobile apps, it is not needed there, otherwise it wouldn't compile due to the added check for nocaps. Change-Id: I20fe7e3b702e4a1782640a2d0e71a40b1517beb6 Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93510 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Jan Holesovsky <ke...@collabora.com> diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp index c31db7317..c4c6ec7cb 100644 --- a/wsd/ClientSession.cpp +++ b/wsd/ClientSession.cpp @@ -1210,13 +1210,15 @@ bool ClientSession::handleKitToClientMessage(const char* buffer, const int lengt // URI constructor implicitly decodes when it gets std::string as param Poco::URI resultURL(encodedURL); - if (resultURL.getScheme() == "file") + + // Prepend the jail path in the normal (non-nocaps) case + if (resultURL.getScheme() == "file" && !LOOLWSD::NoCapsForKit) { std::string relative(resultURL.getPath()); if (relative.size() > 0 && relative[0] == '/') relative = relative.substr(1); - // Rewrite file:// URLs, as they are visible to the outside world. + // Rewrite file:// URLs to be visible to the outside world. const Path path(docBroker->getJailRoot(), relative); if (Poco::File(path).exists()) { diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp index e0e8369a9..a81864506 100644 --- a/wsd/DocumentBroker.cpp +++ b/wsd/DocumentBroker.cpp @@ -2239,6 +2239,7 @@ void DocumentBroker::getIOStats(uint64_t &sent, uint64_t &recv) } } +#if !MOBILEAPP static std::atomic<size_t> NumConverters; size_t ConvertToBroker::getInstanceCount() @@ -2260,7 +2261,6 @@ ConvertToBroker::ConvertToBroker(const std::string& uri, _limitLifeSeconds = limit_convert_secs; } -#if !MOBILEAPP bool ConvertToBroker::startConversion(SocketDisposition &disposition, const std::string &id) { std::shared_ptr<ConvertToBroker> docBroker = std::static_pointer_cast<ConvertToBroker>(shared_from_this()); @@ -2308,7 +2308,6 @@ bool ConvertToBroker::startConversion(SocketDisposition &disposition, const std: }); return true; } -#endif void ConvertToBroker::dispose() { @@ -2347,7 +2346,12 @@ void ConvertToBroker::setLoaded() // FIXME: Check for security violations. Poco::Path toPath(getPublicUri().getPath()); toPath.setExtension(_format); - const std::string toJailURL = "file://" + std::string(JAILED_DOCUMENT_ROOT) + toPath.getFileName(); + + // file:///user/docs/filename.ext normally, file:///<jail-root>/user/docs/filename.ext in the nocaps case + const std::string toJailURL = "file://" + + (LOOLWSD::NoCapsForKit? getJailRoot(): "") + + std::string(JAILED_DOCUMENT_ROOT) + toPath.getFileName(); + std::string encodedTo; Poco::URI::encode(toJailURL, "", encodedTo); @@ -2359,6 +2363,7 @@ void ConvertToBroker::setLoaded() _clientSession->handleMessage(saveasRequest); } +#endif std::vector<std::shared_ptr<ClientSession>> DocumentBroker::getSessionsTestOnlyUnsafe() { diff --git a/wsd/DocumentBroker.hpp b/wsd/DocumentBroker.hpp index 40784b204..f8c2ccea2 100644 --- a/wsd/DocumentBroker.hpp +++ b/wsd/DocumentBroker.hpp @@ -442,6 +442,7 @@ private: static std::atomic<unsigned> DocBrokerId; }; +#if !MOBILEAPP class ConvertToBroker : public DocumentBroker { const std::string _format; @@ -457,10 +458,8 @@ public: const std::string& sOptions); virtual ~ConvertToBroker(); -#if !MOBILEAPP /// Move socket to this broker for response & do conversion bool startConversion(SocketDisposition &disposition, const std::string &id); -#endif /// Called when removed from the DocBrokers list void dispose() override; @@ -474,5 +473,6 @@ public: /// Cleanup path and its parent static void removeFile(const std::string &uri); }; +#endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp index 60d3c0376..3b770cf03 100644 --- a/wsd/LOOLWSD.cpp +++ b/wsd/LOOLWSD.cpp @@ -3434,7 +3434,10 @@ public: << "[ " << DocBrokers.size() << " ]:\n"; for (auto &i : DocBrokers) i.second->dumpState(os); + +#if !MOBILEAPP os << "Converter count: " << ConvertToBroker::getInstanceCount() << "\n"; +#endif Socket::InhibitThreadChecks = false; SocketPoll::InhibitThreadChecks = false; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits