diff --git a/loolwsd/DocumentBroker.hpp b/loolwsd/DocumentBroker.hpp index 471df0c21..89087a00e 100644 --- a/loolwsd/DocumentBroker.hpp +++ b/loolwsd/DocumentBroker.hpp @@ -79,9 +79,9 @@ public: void validate(const Poco::URI& uri) { - Log::info("validating: " + uri.toString()); + Log::info("Validating: " + uri.toString()); auto storage = createStorage("", "", uri); - storage->getFileInfo(uri.toString()); + storage->getFileInfo(uri); } /// Loads a document from the public URI into the jail. diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp index 8c518fcf6..ae896a366 100644 --- a/loolwsd/LOOLWSD.cpp +++ b/loolwsd/LOOLWSD.cpp @@ -579,6 +579,7 @@ private: // Validate the URI and Storage before moving on. docBroker->validate(uriPublic); + Log::debug("Validated [" + uriPublic.toString() + "]."); auto ws = std::make_shared(request, response); auto session = std::make_shared(id, LOOLSession::Kind::ToClient, ws, docBroker); diff --git a/loolwsd/Storage.hpp b/loolwsd/Storage.hpp index 574c844dd..fbc170859 100644 --- a/loolwsd/Storage.hpp +++ b/loolwsd/Storage.hpp @@ -66,7 +66,7 @@ public: const std::string& getUri() const { return _uri; } /// Returns information about the file. - virtual FileInfo getFileInfo(const std::string& uri) = 0; + virtual FileInfo getFileInfo(const Poco::URI& uri) = 0; /// Returns a local file path for the given URI. /// If necessary copies the file locally first. @@ -104,10 +104,12 @@ public: { } - FileInfo getFileInfo(const std::string& uri) + FileInfo getFileInfo(const Poco::URI& uri) { - const auto filename = Poco::Path(uri).getFileName(); - const auto size = Poco::File(uri).getSize(); + const auto path = uri.getPath(); + Log::debug("Getting info for local uri [" + uri.toString() + "], path [" + path + "]."); + const auto filename = Poco::Path(path).getFileName(); + const auto size = Poco::File(path).getSize(); return FileInfo({filename, size}); } @@ -185,9 +187,9 @@ public: { } - FileInfo getFileInfo(const std::string& uri) + FileInfo getFileInfo(const Poco::URI& uri) { - Log::info("FileInfo for URI [" + uri + "]."); + Log::debug("Getting info for wopi uri [" + uri.toString() + "]."); Poco::URI uriObject(uri); Poco::Net::HTTPClientSession session(uriObject.getHost(), uriObject.getPort()); @@ -199,7 +201,7 @@ public: std::istream& rs = session.receiveResponse(response); auto logger = Log::trace(); - logger << "WOPI::CheckFileInfo header for URI [" << uri << "]:\n"; + logger << "WOPI::CheckFileInfo header for URI [" << uri.toString() << "]:\n"; for (auto& pair : response) { logger << '\t' + pair.first + ": " + pair.second << " / "; @@ -232,7 +234,7 @@ public: { Log::info("Downloading URI [" + _uri + "]."); - _fileInfo = getFileInfo(_uri); + _fileInfo = getFileInfo(Poco::URI(_uri)); if (_fileInfo.Size == 0 && _fileInfo.Filename.empty()) { //TODO: Should throw a more appropriate exception. @@ -320,8 +322,9 @@ public: { } - FileInfo getFileInfo(const std::string& uri) + FileInfo getFileInfo(const Poco::URI& uri) { + Log::debug("Getting info for webdav uri [" + uri.toString() + "]."); (void)uri; assert(!"Not Implemented!"); return FileInfo({"bazinga", 0});