[Libreoffice-commits] online.git: wsd/DocumentBroker.cpp wsd/Storage.cpp wsd/Storage.hpp

Pranav Kant pranavk at collabora.co.uk
Fri Aug 18 02:01:35 UTC 2017


 wsd/DocumentBroker.cpp |    2 +-
 wsd/Storage.cpp        |    5 +++--
 wsd/Storage.hpp        |    2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 769e41dfb21a17a50cb0d768451d0838bc30f2f3
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Fri Aug 18 07:14:33 2017 +0530

    Fix build
    
    Mismerge. There is no session->getAccessToken now
    
    Change-Id: I4d8f2cc612cbd39b3163bcdbba5df8ea5d732774

diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 016d251d..77035837 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -729,7 +729,7 @@ void DocumentBroker::saveFileAs(const std::string& sessionId, const std::string&
     WopiStorage* wopiStorage = dynamic_cast<WopiStorage*>(_storage.get());
     if (wopiStorage != nullptr)
     {
-        const std::string newUrl = wopiStorage->createCopyFile(it->second->getAccessToken(), newFileName, path);
+        const std::string newUrl = wopiStorage->createCopyFile(it->second->getAuthorization(), newFileName, path);
         if (!newUrl.empty())
         {
             it->second->sendTextFrame("saveas: " + newUrl + " " + newFileName);
diff --git a/wsd/Storage.cpp b/wsd/Storage.cpp
index 1472faa6..db047aba 100644
--- a/wsd/Storage.cpp
+++ b/wsd/Storage.cpp
@@ -585,12 +585,12 @@ std::unique_ptr<WopiStorage::WOPIFileInfo> WopiStorage::getWOPIFileInfo(const Au
 }
 
 /// PutRelativeFile - uri format: http://server/<...>/wopi*/files/<id>/
-std::string WopiStorage::createCopyFile(const std::string& accessToken, const std::string& newFileName, const std::string& path)
+std::string WopiStorage::createCopyFile(const Authorization& auth, const std::string& newFileName, const std::string& path)
 {
     const auto size = getFileSize(_jailedFilePath);
     std::ostringstream oss;
     Poco::URI uriObject(_uri);
-    setQueryParameter(uriObject, "access_token", accessToken);
+    auth.authorizeURI(uriObject);
 
     LOG_DBG("Wopi PutRelativeFile(save as) request for : " << uriObject.toString());
 
@@ -600,6 +600,7 @@ std::string WopiStorage::createCopyFile(const std::string& accessToken, const st
 
         Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_POST, uriObject.getPathAndQuery(), Poco::Net::HTTPMessage::HTTP_1_1);
         request.set("User-Agent", WOPI_AGENT_STRING);
+        auth.authorizeRequest(request);
         request.set("X-WOPI-Override", "PUT_RELATIVE");
         request.set("X-WOPI-RelativeTarget", newFileName + "." + getFileExtension());
         request.set("X-WOPI-Size", std::to_string(size));
diff --git a/wsd/Storage.hpp b/wsd/Storage.hpp
index da30b1b9..827a8fa7 100644
--- a/wsd/Storage.hpp
+++ b/wsd/Storage.hpp
@@ -259,7 +259,7 @@ public:
     std::unique_ptr<WOPIFileInfo> getWOPIFileInfo(const Authorization& auth);
 
     /// returns
-    std::string createCopyFile(const std::string& accessToken, const std::string& newFileName, const std::string& path);
+    std::string createCopyFile(const Authorization& auth, const std::string& newFileName, const std::string& path);
 
     /// uri format: http://server/<...>/wopi*/files/<id>/content
     std::string loadStorageFileToLocal(const Authorization& auth) override;


More information about the Libreoffice-commits mailing list