loolwsd/LOOLWSD.cpp | 1 - loolwsd/LOOLWSD.hpp | 24 +++++++++++++----------- loolwsd/MasterProcessSession.cpp | 5 +++-- 3 files changed, 16 insertions(+), 14 deletions(-)
New commits: commit c980ece8bcca0bf8c6c569a9db37b085022952e5 Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> Date: Thu Mar 3 21:00:57 2016 -0500 loolwsd: preparing for wopi storage Change-Id: Iae1bd042d84603cf81115789df40f50e8dc20d16 Reviewed-on: https://gerrit.libreoffice.org/22884 Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> Tested-by: Ashod Nakashian <ashnak...@gmail.com> diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp index 8ad52d7..ad5726b 100644 --- a/loolwsd/LOOLWSD.cpp +++ b/loolwsd/LOOLWSD.cpp @@ -103,7 +103,6 @@ DEALINGS IN THE SOFTWARE. #include "LOOLWSD.hpp" #include "MasterProcessSession.hpp" #include "QueueHandler.hpp" -#include "Storage.hpp" #include "Util.hpp" using namespace LOOLProtocol; diff --git a/loolwsd/LOOLWSD.hpp b/loolwsd/LOOLWSD.hpp index 696ca3a..ba11e68 100644 --- a/loolwsd/LOOLWSD.hpp +++ b/loolwsd/LOOLWSD.hpp @@ -23,6 +23,7 @@ #include <Poco/Process.h> #include "Auth.hpp" +#include "Storage.hpp" #include "Common.hpp" #include "Util.hpp" @@ -34,8 +35,8 @@ public: static std::shared_ptr<DocumentURI> create(const std::string& url, - const std::string& jailRoot, - const std::string& childId) + const std::string& jailRoot, + const std::string& childId) { // TODO: Sanitize the url and limit access! auto uriPublic = Poco::URI(url); @@ -52,16 +53,17 @@ public: // The URL is the publicly visible one, not visible in the chroot jail. // We need to map it to a jailed path and copy the file there. + + // chroot/jailId/user/doc + const auto jailedDocRoot = Poco::Path(jailRoot, JailedDocumentRoot); + + // chroot/jailId/user/doc/childId + const auto docPath = Poco::Path(jailedDocRoot, childId); + Poco::File(docPath).createDirectories(); + auto uriJailed = uriPublic; if (uriPublic.isRelative() || uriPublic.getScheme() == "file") { - // chroot/jailId/user/doc - const auto jailedDocRoot = Poco::Path(jailRoot, JailedDocumentRoot); - - // chroot/jailId/user/doc/childId - const auto docPath = Poco::Path(jailedDocRoot, childId); - Poco::File(docPath).createDirectories(); - const auto filename = Poco::Path(uriPublic.getPath()).getFileName(); // chroot/jailId/user/doc/childId/file.ext @@ -113,8 +115,8 @@ public: private: DocumentURI(const Poco::URI& uriPublic, - const Poco::URI& uriJailed, - const std::string& jailId) : + const Poco::URI& uriJailed, + const std::string& jailId) : _uriPublic(uriPublic), _uriJailed(uriJailed), _jailId(jailId) diff --git a/loolwsd/MasterProcessSession.cpp b/loolwsd/MasterProcessSession.cpp index 126a12b..55ccdaf 100644 --- a/loolwsd/MasterProcessSession.cpp +++ b/loolwsd/MasterProcessSession.cpp @@ -451,10 +451,11 @@ bool MasterProcessSession::loadDocument(const char* /*buffer*/, int /*length*/, try { - Poco::URI aUri(_docURL); + // Strip query params because we need unique URI (need a better solution!). + StringTokenizer tokens(_docURL, "?", StringTokenizer::TOK_IGNORE_EMPTY | StringTokenizer::TOK_TRIM); // request new URL session - const std::string aMessage = "request " + getId() + " " + _docURL + "\r\n"; + const std::string aMessage = "request " + getId() + " " + tokens[0] + "\r\n"; Log::trace("MasterToBroker: " + aMessage.substr(0, aMessage.length()-2)); Util::writeFIFO(LOOLWSD::BrokerWritePipe, aMessage); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits