Skip to content

Commit

Permalink
Added debug logs for metadata update for nested folders.
Browse files Browse the repository at this point in the history
Signed-off-by: alex-z <[email protected]>
  • Loading branch information
allexzander committed Jan 17, 2024
1 parent dfd2c56 commit 8661140
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/libsync/clientsideencryptionjobs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ bool GetMetadataApiJob::finished()
const auto replyData = reply()->readAll();
auto json = QJsonDocument::fromJson(replyData, &error);
qCInfo(lcCseJob) << "metadata received for file id" << _fileId << json.toJson(QJsonDocument::Compact);
qCInfo(lcCseJob()) << "[DEBUG_NESTED_METADATA_ISSUE] END SUCCESS GET metadata for folderId:" << _fileId << "with signature:" << _signature
<< "metadata:" << replyData.toBase64()
<< "to url: " << reply()->url();
qCInfo(lcCseJob()) << "[DEBUG_NESTED_METADATA_ISSUE] FOR GET signature:" << _signature << "to url: " << reply()->url();
emit jsonReceived(json, reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt());
return true;
}
Expand Down Expand Up @@ -98,6 +102,9 @@ void StoreMetaDataApiJob::start()
if (!_signature.isEmpty()) {
req.setRawHeader(e2eeSignatureHeaderName, _signature);
}
qCInfo(lcCseJob()) << "[DEBUG_NESTED_METADATA_ISSUE] signature is supported and is set to" << e2eeSignatureHeaderName << ":" << _signature;
} else {
qCInfo(lcCseJob()) << "[DEBUG_NESTED_METADATA_ISSUE] signature is not supported";
}
QUrlQuery query;
query.addQueryItem(QLatin1String("format"), QLatin1String("json"));
Expand All @@ -114,6 +121,9 @@ void StoreMetaDataApiJob::start()
buffer->setData(data);

qCInfo(lcCseJob()) << "sending the metadata for the fileId" << _fileId << "as encrypted";
qCInfo(lcCseJob()) << "[DEBUG_NESTED_METADATA_ISSUE] START POST metadata for folderId:" << _fileId << "with token:" << _token << "to url: " << url
<< "metadata:" << _b64Metadata.toBase64();
qCInfo(lcCseJob()) << "[DEBUG_NESTED_METADATA_ISSUE] FOR POST signature:" << _signature;
sendRequest("POST", url, req, buffer);
AbstractNetworkJob::start();
}
Expand All @@ -127,6 +137,9 @@ bool StoreMetaDataApiJob::finished()
return false;
}

qCInfo(lcCseJob()) << "[DEBUG_NESTED_METADATA_ISSUE] END SUCCESS POST metadata for folderId:" << _fileId << "with token:" << _token
<< "to url: " << reply()->url();

qCInfo(lcCseJob()) << "Metadata submitted to the server successfully";
emit success(_fileId);
return true;
Expand Down Expand Up @@ -156,6 +169,9 @@ void UpdateMetadataApiJob::start()
if (!_signature.isEmpty()) {
req.setRawHeader(e2eeSignatureHeaderName, _signature);
}
qCInfo(lcCseJob()) << "[DEBUG_NESTED_METADATA_ISSUE] signature is supported and is set to" << e2eeSignatureHeaderName << ":" << _signature;
} else {
qCInfo(lcCseJob()) << "[DEBUG_NESTED_METADATA_ISSUE] signature is not supported";
}

QUrlQuery urlQuery;
Expand All @@ -178,6 +194,9 @@ void UpdateMetadataApiJob::start()
buffer->setData(data);

qCInfo(lcCseJob()) << "updating the metadata for the fileId" << _fileId << "as encrypted";
qCInfo(lcCseJob()) << "[DEBUG_NESTED_METADATA_ISSUE] START POST metadata for folderId:" << _fileId << "with token:" << _token << "to url: " << url
<< "metadata:" << _b64Metadata.toBase64();
qCInfo(lcCseJob()) << "[DEBUG_NESTED_METADATA_ISSUE] FOR POST signature:" << _signature;
sendRequest("PUT", url, req, buffer);
AbstractNetworkJob::start();
}
Expand All @@ -191,6 +210,9 @@ bool UpdateMetadataApiJob::finished()
return false;
}

qCInfo(lcCseJob()) << "[DEBUG_NESTED_METADATA_ISSUE] END SUCCESS POST metadata for folderId:" << _fileId << "with token:" << _token
<< "to url: " << reply()->url();

qCInfo(lcCseJob()) << "Metadata submitted to the server successfully";
emit success(_fileId);
return true;
Expand Down Expand Up @@ -222,6 +244,8 @@ void UnlockEncryptFolderApiJob::start()
url.setQuery(query);
}

qCInfo(lcCseJob()) << "[DEBUG_NESTED_METADATA_ISSUE] START DELETE unlock for folderId:" << _fileId << "with token:" << _token << "to url:" << url;

sendRequest("DELETE", url, req);

AbstractNetworkJob::start();
Expand Down Expand Up @@ -258,6 +282,7 @@ bool UnlockEncryptFolderApiJob::finished()
emit error(_fileId, retCode, errorString());
return true;
}
qCInfo(lcCseJob()) << "[DEBUG_NESTED_METADATA_ISSUE] END DELETE SUCCESS imlock for folderId:" << _fileId << "with token:" << _token << "to url:" << reply()->url();
emit success(_fileId);
return true;
}
Expand Down Expand Up @@ -337,6 +362,9 @@ void LockEncryptFolderApiJob::start()
url.setQuery(query);

qCInfo(lcCseJob()) << "locking the folder with id" << _fileId << "as encrypted";

qCInfo(lcCseJob()) << "[DEBUG_NESTED_METADATA_ISSUE] START POST lock for folderId:" << _fileId << "to url:" << url;

sendRequest("POST", url, req);
AbstractNetworkJob::start();

Expand Down Expand Up @@ -367,6 +395,8 @@ bool LockEncryptFolderApiJob::finished()
_journalDb->setE2EeLockedFolder(_fileId, folderTokenEncrypted);
}

qCInfo(lcCseJob()) << "[DEBUG_NESTED_METADATA_ISSUE] END POST SUCCESS lock for folderId:" << _fileId << "to url:" << reply()->url();

//TODO: Parse the token and submit.
emit success(_fileId, token);
return true;
Expand Down

0 comments on commit 8661140

Please sign in to comment.