wsd: minor cleanup of CheckFileInfo logging
Change-Id: I45a7d281a640cbadfd42f1411f53946ae0142653 (cherry picked from commit 9a35fcd269877f3b42bb34c0d1b3bd6e98450d7d)
This commit is contained in:
parent
9bfe8b70e2
commit
a80c5e70c4
1 changed files with 13 additions and 7 deletions
|
@ -498,6 +498,11 @@ std::unique_ptr<WopiStorage::WOPIFileInfo> WopiStorage::getWOPIFileInfo(const Au
|
|||
Poco::JSON::Object::Ptr object;
|
||||
if (JsonUtil::parseJSON(wopiResponse, object))
|
||||
{
|
||||
if (LOOLWSD::AnonymizeFilenames || LOOLWSD::AnonymizeUsernames)
|
||||
LOG_DBG("WOPI::CheckFileInfo (" << callDuration.count() * 1000. << " ms): anonymizing...");
|
||||
else
|
||||
LOG_DBG("WOPI::CheckFileInfo (" << callDuration.count() * 1000. << " ms): " << wopiResponse);
|
||||
|
||||
JsonUtil::findJSONValue(object, "BaseFileName", filename);
|
||||
JsonUtil::findJSONValue(object, "OwnerId", ownerId);
|
||||
JsonUtil::findJSONValue(object, "UserId", userId);
|
||||
|
@ -545,10 +550,9 @@ std::unique_ptr<WopiStorage::WOPIFileInfo> WopiStorage::getWOPIFileInfo(const Au
|
|||
object->remove("UserId");
|
||||
object->remove("UserFriendlyName");
|
||||
}
|
||||
}
|
||||
|
||||
// Log either an original or anonymized version, depending on anonymization flags.
|
||||
LOG_DBG("WOPI::CheckFileInfo (" << callDuration.count() * 1000. << " ms): " << wopiResponse);
|
||||
LOG_DBG("WOPI::CheckFileInfo (" << callDuration.count() * 1000. << " ms): " << wopiResponse);
|
||||
}
|
||||
|
||||
JsonUtil::findJSONValue(object, "Size", size);
|
||||
JsonUtil::findJSONValue(object, "UserExtraInfo", userExtraInfo);
|
||||
|
@ -576,10 +580,12 @@ std::unique_ptr<WopiStorage::WOPIFileInfo> WopiStorage::getWOPIFileInfo(const Au
|
|||
else
|
||||
{
|
||||
if (LOOLWSD::AnonymizeFilenames || LOOLWSD::AnonymizeUsernames)
|
||||
LOG_ERR("WOPI::CheckFileInfo failed or no valid JSON payload returned. Access denied.");
|
||||
else
|
||||
LOG_ERR("WOPI::CheckFileInfo failed or no valid JSON payload returned. Access denied. "
|
||||
"Original response: [" << wopiResponse << "].");
|
||||
wopiResponse = "obfuscated";
|
||||
|
||||
LOG_ERR("WOPI::CheckFileInfo (" << callDuration.count() * 1000. <<
|
||||
" ms) failed or no valid JSON payload returned. Access denied. "
|
||||
"Original response: [" << wopiResponse << "].");
|
||||
|
||||
throw UnauthorizedRequestException("Access denied. WOPI::CheckFileInfo failed on: " + uriAnonym);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue