[Libreoffice-commits] online.git: loleaflet/js wsd/LOOLWSD.cpp

Ashod Nakashian (via logerrit) logerrit at kemper.freedesktop.org
Tue Jun 2 18:05:38 UTC 2020


 loleaflet/js/global.js |   11 +++++++++--
 wsd/LOOLWSD.cpp        |    6 +++---
 2 files changed, 12 insertions(+), 5 deletions(-)

New commits:
commit 4513318e58ed22709637374918fec3a95ad5dcab
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Mon Jun 1 08:18:13 2020 -0400
Commit:     Ashod Nakashian <ashnakash at gmail.com>
CommitDate: Tue Jun 2 20:05:19 2020 +0200

    wsd: leaflet: fix reuse_cookies support
    
    reuse_cookies is now always encoded in the URL.
    
    And, there is no need for the WOPISrc in the three cases
    in this patch, and by passing the DocumentURI proper
    (without /ws?WOPISrc=...) ensures that all query-params
    in the DocumentURI are properly processed.
    
    This fixes the reuse_cookies regression where it
    wasn't passed to WOPI requests.
    
    Change-Id: I8dccfb09a7b4102d10c1aef24f43b699a07bfed8
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95293
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index 20757e2a5..1c951b089 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -653,9 +653,16 @@
 		else if (global.accessHeader !== '') {
 			wopiParams = { 'access_header': global.accessHeader };
 		}
-		else if (global.reuseCookies !== '') {
-			wopiParams = { 'reuse_cookies': global.reuseCookies };
+
+		if (global.reuseCookies !== '') {
+			if (wopiParams) {
+				wopiParams['reuse_cookies'] = global.reuseCookies;
+			}
+			else {
+				wopiParams = { 'reuse_cookies': global.reuseCookies };
+			}
 		}
+
 		if (wopiParams) {
 			docParams = Object.keys(wopiParams).map(function(key) {
 				return encodeURIComponent(key) + '=' + encodeURIComponent(wopiParams[key]);
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 51bd22e38..db7bfbaef 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -2810,7 +2810,7 @@ private:
                 const std::string formName(form.get("name"));
 
                 // Validate the docKey
-                const std::string decodedUri = requestDetails.getLegacyDocumentURI();
+                const std::string decodedUri = requestDetails.getDocumentURI();
                 const std::string docKey = DocumentBroker::getDocKey(DocumentBroker::sanitizeURI(decodedUri));
 
                 std::unique_lock<std::mutex> docBrokersLock(DocBrokersMutex);
@@ -2846,7 +2846,7 @@ private:
             // TODO: Check that the user in question has access to this file!
 
             // 1. Validate the dockey
-            const std::string decodedUri = requestDetails.getLegacyDocumentURI();
+            const std::string decodedUri = requestDetails.getDocumentURI();
             const std::string docKey = DocumentBroker::getDocKey(DocumentBroker::sanitizeURI(decodedUri));
 
             std::unique_lock<std::mutex> docBrokersLock(DocBrokersMutex);
@@ -3025,7 +3025,7 @@ private:
                                SocketDisposition& disposition,
                                const std::shared_ptr<StreamSocket>& socket)
     {
-        const std::string url = requestDetails.getLegacyDocumentURI();
+        const std::string url = requestDetails.getDocumentURI();
         assert(socket && "Must have a valid socket");
 
         // must be trace for anonymization


More information about the Libreoffice-commits mailing list