aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/cloud/dropbox/dropboxstorage.cpp7
-rw-r--r--backends/cloud/dropbox/dropboxuploadrequest.cpp12
2 files changed, 14 insertions, 5 deletions
diff --git a/backends/cloud/dropbox/dropboxstorage.cpp b/backends/cloud/dropbox/dropboxstorage.cpp
index 1f983cec67..ab3f5d0874 100644
--- a/backends/cloud/dropbox/dropboxstorage.cpp
+++ b/backends/cloud/dropbox/dropboxstorage.cpp
@@ -105,6 +105,7 @@ void DropboxStorage::printBool(BoolResponse pair) {
}
void DropboxStorage::printUploadStatus(UploadResponse pair) {
+ debug(" ");
UploadStatus status = pair.value;
if (status.interrupted) {
debug("upload interrupted by user");
@@ -118,9 +119,9 @@ void DropboxStorage::printUploadStatus(UploadResponse pair) {
debug("upload HTTP response code = %ld", status.httpResponseCode);
if (!status.failed) {
debug("uploaded file info:");
- debug("path: %s", status.file.path().c_str());
- debug("size: %u", status.file.size());
- debug("timestamp: %u", status.file.timestamp());
+ debug("\tpath: %s", status.file.path().c_str());
+ debug("\tsize: %u", status.file.size());
+ debug("\ttimestamp: %u", status.file.timestamp());
}
}
diff --git a/backends/cloud/dropbox/dropboxuploadrequest.cpp b/backends/cloud/dropbox/dropboxuploadrequest.cpp
index 18e1173eef..e422793bc4 100644
--- a/backends/cloud/dropbox/dropboxuploadrequest.cpp
+++ b/backends/cloud/dropbox/dropboxuploadrequest.cpp
@@ -65,8 +65,16 @@ void DropboxUploadRequest::uploadNextPart() {
Common::JSONObject jsonRequestParameters;
if (_contentsStream->pos() == 0 || _sessionId == "") {
- url += "start";
- jsonRequestParameters.setVal("close", new Common::JSONValue(false));
+ if (_contentsStream->size() <= UPLOAD_PER_ONE_REQUEST) {
+ url = "https://content.dropboxapi.com/2/files/upload";
+ jsonRequestParameters.setVal("path", new Common::JSONValue(_savePath));
+ jsonRequestParameters.setVal("mode", new Common::JSONValue("overwrite"));
+ jsonRequestParameters.setVal("autorename", new Common::JSONValue(false));
+ jsonRequestParameters.setVal("mute", new Common::JSONValue(false));
+ } else {
+ url += "start";
+ jsonRequestParameters.setVal("close", new Common::JSONValue(false));
+ }
} else {
if (_contentsStream->size() - _contentsStream->pos() <= UPLOAD_PER_ONE_REQUEST) {
url += "finish";