[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-2-0' - wsd/FileServer.cpp

Andras Timar andras.timar at collabora.com
Wed Dec 14 12:57:12 UTC 2016


 wsd/FileServer.cpp |   22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

New commits:
commit e82ac54be27406a2fbb731d0dc42b7930b026992
Author: Andras Timar <andras.timar at collabora.com>
Date:   Mon Dec 12 19:28:37 2016 +0100

    wsd: do not log error, when access_token_ttl is not passed
    
    (cherry picked from commit 708f9be23ad7460b8cf0459d03494aaf538bb808)
    wsd: do not warn about missing access_token_ttl, when there is no access_token
    (cherry picked from commit 0b596ae51d10d4391626b9e1ed3184f89b5e6fd0)
    
    Change-Id: I5bc8bfc3d245a2fc70922f2d28a1bb68880e7fc2
    Reviewed-on: https://gerrit.libreoffice.org/31920
    Reviewed-by: pranavk <pranavk at collabora.co.uk>
    Tested-by: pranavk <pranavk at collabora.co.uk>

diff --git a/wsd/FileServer.cpp b/wsd/FileServer.cpp
index 1c9ba47..8f1f1fe 100644
--- a/wsd/FileServer.cpp
+++ b/wsd/FileServer.cpp
@@ -237,13 +237,23 @@ void FileServerRequestHandler::preprocessFile(HTTPServerRequest& request, HTTPSe
     Poco::URI::encode(accessToken, "'", escapedAccessToken);
 
     unsigned long tokenTtl = 0;
-    try
-    {
-        tokenTtl = std::stoul(accessTokenTtl);
-    }
-    catch(const std::exception& exc)
+    if (accessToken != "")
     {
-        LOG_ERR("access_token_ttl must be a unix timestamp of when token will expire");
+        if (accessTokenTtl != "")
+        {
+            try
+            {
+                tokenTtl = std::stoul(accessTokenTtl);
+            }
+            catch(const std::exception& exc)
+            {
+                LOG_ERR("access_token_ttl must be represented as the number of milliseconds since January 1, 1970 UTC, when the token will expire");
+            }
+        }
+        else
+        {
+            LOG_WRN("WOPI host did not pass optional access_token_ttl");
+        }
     }
 
     Poco::replaceInPlace(preprocess, std::string("%ACCESS_TOKEN%"), escapedAccessToken);


More information about the Libreoffice-commits mailing list