Commit aef99161 authored by blam's avatar blam

Merge branch 'jb53795-upload-session' into 'master'

[buteo-sync-plugins-social] OneDrive backup uploads should use upload sessions. Fixes JB#53795

See merge request !93
parents 6244a0b3 02fe26ce
......@@ -80,7 +80,8 @@ private Q_SLOTS:
void remotePathFinishedHandler();
void remoteFileFinishedHandler();
void createRemotePathFinishedHandler();
void createRemoteFileFinishedHandler();
void filePartUploadFinishedHandler();
void createUploadSessionFinishedHandler();
void downloadProgressHandler(qint64 bytesReceived, qint64 bytesTotal);
void uploadProgressHandler(qint64 bytesSent, qint64 bytesTotal);
......@@ -102,7 +103,12 @@ private:
QList<RemoteDirectory> m_remoteDirectories;
QString m_accessToken;
QString m_remoteDirPath;
QString m_uploadSessionUrl;
QFileInfo m_localFileInfo;
QFile *m_uploadFile = nullptr;
qint64 m_nextFileUploadPos = 0;
int m_accountId = 0;
};
......
......@@ -93,6 +93,8 @@ void OneDriveDataTypeSyncAdaptor::errorHandler(QNetworkReply::NetworkError err)
{
// OneDrive sends error code 204 (HTTP code 401) for Unauthorized Error
QNetworkReply *reply = qobject_cast<QNetworkReply*>(sender());
const int httpCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
if (err == QNetworkReply::AuthenticationRequiredError) {
int httpCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
SOCIALD_LOG_INFO("sociald:OneDrive: received:" << httpCode <<
......@@ -103,7 +105,8 @@ void OneDriveDataTypeSyncAdaptor::errorHandler(QNetworkReply::NetworkError err)
SOCIALD_LOG_ERROR(SocialNetworkSyncAdaptor::dataTypeName(m_dataType) <<
"request with account" << sender()->property("accountId").toInt() <<
"experienced error:" << err);
"experienced error:" << err << "HTTP code:" << httpCode
<< "data:" << reply->readAll());
// set "isError" on the reply so that adapters know to ignore the result in the finished() handler
reply->setProperty("isError", QVariant::fromValue<bool>(true));
// Note: not all errors are "unrecoverable" errors, so we don't change the status here.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment