loolwsd/Storage.cpp | 4 +++- loolwsd/Storage.hpp | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-)
New commits: commit c9346e14b1013a12db81d7d2f8f287d841976f2a Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Fri Sep 30 11:02:09 2016 +0200 LocalStorage: differentiate between multiple localhost users Hopefully useful in general, but currently I need this to see if view ids are mapped to the correct user names even with file:/// URLs. Change-Id: Iec7d552ee0b0d53738040d868e49ecb7e9c10843 diff --git a/loolwsd/Storage.cpp b/loolwsd/Storage.cpp index c0e1c4c..89efd79 100644 --- a/loolwsd/Storage.cpp +++ b/loolwsd/Storage.cpp @@ -163,6 +163,8 @@ std::unique_ptr<StorageBase> StorageBase::create(const std::string& jailRoot, co throw BadRequestException("No Storage configured or invalid URI."); } +unsigned LocalStorage::LastLocalStorageId = 0; + StorageBase::FileInfo LocalStorage::getFileInfo(const Poco::URI& uri) { const auto path = Poco::Path(uri.getPath()); @@ -171,7 +173,7 @@ StorageBase::FileInfo LocalStorage::getFileInfo(const Poco::URI& uri) const auto file = Poco::File(path); const auto lastModified = file.getLastModified(); const auto size = file.getSize(); - return FileInfo({filename, lastModified, size, "localhost", "Local Host"}); + return FileInfo({filename, lastModified, size, "localhost", std::string("Local Host #") + std::to_string(_localStorageId)}); } std::string LocalStorage::loadStorageFileToLocal() diff --git a/loolwsd/Storage.hpp b/loolwsd/Storage.hpp index 6ab3e93..23bc7cd 100644 --- a/loolwsd/Storage.hpp +++ b/loolwsd/Storage.hpp @@ -118,7 +118,8 @@ public: const std::string& jailPath, const std::string& uri) : StorageBase(localStorePath, jailPath, uri), - _isCopy(false) + _isCopy(false), + _localStorageId(LocalStorage::LastLocalStorageId++) { Log::info("LocalStorage ctor with localStorePath: [" + localStorePath + "], jailPath: [" + jailPath + "], uri: [" + uri + "]."); @@ -133,6 +134,9 @@ public: private: /// True if the jailed file is not linked but copied. bool _isCopy; + static unsigned LastLocalStorageId; + /// Used to differentiate between multiple localhost users. + const unsigned _localStorageId; }; /// WOPI protocol backed storage. _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits