[Libreoffice-commits] online.git: wsd/FileServer.cpp

Andras Timar andras.timar at collabora.com
Tue Dec 13 10:03:42 UTC 2016


 wsd/FileServer.cpp |   21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

New commits:
commit 0b596ae51d10d4391626b9e1ed3184f89b5e6fd0
Author: Andras Timar <andras.timar at collabora.com>
Date:   Tue Dec 13 09:55:31 2016 +0100

    wsd: do not warn about missing access_token_ttl, when there is no access_token
    
    Change-Id: I6ac7014dee21892dfd8b3b594cafe2dc030b6b2a

diff --git a/wsd/FileServer.cpp b/wsd/FileServer.cpp
index 3d64847..8f1f1fe 100644
--- a/wsd/FileServer.cpp
+++ b/wsd/FileServer.cpp
@@ -237,21 +237,24 @@ void FileServerRequestHandler::preprocessFile(HTTPServerRequest& request, HTTPSe
     Poco::URI::encode(accessToken, "'", escapedAccessToken);
 
     unsigned long tokenTtl = 0;
-    if (accessTokenTtl != "")
+    if (accessToken != "")
     {
-        try
+        if (accessTokenTtl != "")
         {
-            tokenTtl = std::stoul(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");
+            }
         }
-        catch(const std::exception& exc)
+        else
         {
-            LOG_ERR("access_token_ttl must be a unix timestamp of when token will expire");
+            LOG_WRN("WOPI host did not pass optional access_token_ttl");
         }
     }
-    else
-    {
-        LOG_WRN("WOPI host did not pass access_token_ttl");
-    }
 
     Poco::replaceInPlace(preprocess, std::string("%ACCESS_TOKEN%"), escapedAccessToken);
     Poco::replaceInPlace(preprocess, std::string("%ACCESS_TOKEN_TTL%"), std::to_string(tokenTtl));


More information about the Libreoffice-commits mailing list