[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-2-1' - loleaflet/dist loleaflet/src wsd/DocumentBroker.cpp wsd/Storage.cpp wsd/Storage.hpp
Pranav Kant
pranavk at collabora.co.uk
Wed May 31 12:32:55 UTC 2017
loleaflet/dist/errormessages.js | 1 +
loleaflet/src/core/Socket.js | 3 +++
wsd/DocumentBroker.cpp | 5 +++++
wsd/Storage.cpp | 4 ++++
wsd/Storage.hpp | 1 +
5 files changed, 14 insertions(+)
New commits:
commit 43da694acab846eec14b3013da6449d5e24765bf
Author: Pranav Kant <pranavk at collabora.co.uk>
Date: Wed May 31 11:51:12 2017 +0530
Handle WOPI PutFile unauthorized access token
Change-Id: I29ee8cc0c9f3ea42f70628eca6f74d161d1a38f9
(cherry picked from commit d840e8720a2ba45ae981b53e5a06b4d28f847314)
Reviewed-on: https://gerrit.libreoffice.org/38259
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
Tested-by: Jan Holesovsky <kendy at collabora.com>
diff --git a/loleaflet/dist/errormessages.js b/loleaflet/dist/errormessages.js
index 89f31fc7..8ea1185c 100644
--- a/loleaflet/dist/errormessages.js
+++ b/loleaflet/dist/errormessages.js
@@ -12,5 +12,6 @@ exports.faileddocloading = _('Failed to load the document. Please ensure the fil
exports.storage = {
loadfailed: _('Failed to read document from storage. Please contact your storage server (%storageserver) administrator.'),
savediskfull: _('Save failed due to no disk space left on storage server. Document will now be read-only. Please contact the server (%storageserver) administrator to continue editing.'),
+ saveunauthorized: _('Document cannot be saved to storage server (%storageserver) due to expired or invalid access token. Refresh your session to not to lose your work.'),
savefailed: _('Document cannot be saved to storage. Check your permissions or contact the storage server (%storageserver) administrator.')
};
diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index 25f5f83f..fdce2a54 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -320,6 +320,9 @@ L.Socket = L.Class.extend({
else if (command.errorKind === 'savefailed') {
storageError = errorMessages.storage.savefailed;
}
+ else if (command.errorKind === 'saveunauthorized') {
+ storageError = errorMessages.storage.saveunauthorized;
+ }
else if (command.errorKind === 'loadfailed') {
storageError = errorMessages.storage.loadfailed;
// Since this is a document load failure, wsd will disconnect the socket anyway,
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 5b15fff1..1e4870e1 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -642,6 +642,11 @@ bool DocumentBroker::saveToStorageInternal(const std::string& sessionId,
sessionIt.second->sendTextFrame("error: cmd=storage kind=savediskfull");
}
}
+ else if (storageSaveResult == StorageBase::SaveResult::UNAUTHORIZED)
+ {
+ LOG_ERR("Cannot save docKey [" << _docKey << "] to storage URI [" << uri << "]. Invalid or expired access token. Notifying client.");
+ it->second->sendTextFrame("error: cmd=storage kind=saveunauthorized");
+ }
else if (storageSaveResult == StorageBase::SaveResult::FAILED)
{
//TODO: Should we notify all clients?
diff --git a/wsd/Storage.cpp b/wsd/Storage.cpp
index e05641b6..4e6e6567 100644
--- a/wsd/Storage.cpp
+++ b/wsd/Storage.cpp
@@ -660,6 +660,10 @@ StorageBase::SaveResult WopiStorage::saveLocalFileToStorage(const std::string& a
{
saveResult = StorageBase::SaveResult::DISKFULL;
}
+ else if (response.getStatus() == Poco::Net::HTTPResponse::HTTP_UNAUTHORIZED)
+ {
+ saveResult = StorageBase::SaveResult::UNAUTHORIZED;
+ }
}
catch(const Poco::Exception& pexc)
{
diff --git a/wsd/Storage.hpp b/wsd/Storage.hpp
index 6613fbbc..d0dff593 100644
--- a/wsd/Storage.hpp
+++ b/wsd/Storage.hpp
@@ -57,6 +57,7 @@ public:
{
OK,
DISKFULL,
+ UNAUTHORIZED,
FAILED
};
More information about the Libreoffice-commits
mailing list