diff --git a/src/libsync/propagateupload.cpp b/src/libsync/propagateupload.cpp index a8b260515c..d50658e022 100644 --- a/src/libsync/propagateupload.cpp +++ b/src/libsync/propagateupload.cpp @@ -573,11 +573,11 @@ void PropagateUploadFileCommon::abortWithError(SyncFileItem::Status status, cons QMap PropagateUploadFileCommon::headers() { QMap headers; - headers["OC-Async"] = "1"; - headers["Content-Type"] = "application/octet-stream"; - headers["X-OC-Mtime"] = QByteArray::number(qint64(_item->_modtime)); + headers[QByteArrayLiteral("OC-Async")] = QByteArrayLiteral("1"); + headers[QByteArrayLiteral("Content-Type")] = QByteArrayLiteral("application/octet-stream"); + headers[QByteArrayLiteral("X-OC-Mtime")] = QByteArray::number(qint64(_item->_modtime)); - if (_item->_file.contains(".sys.admin#recall#")) { + if (_item->_file.contains(QLatin1String(".sys.admin#recall#"))) { // This is a file recall triggered by the admin. Note: the // recall list file created by the admin and downloaded by the // client (.sys.admin#recall#) also falls into this category @@ -594,21 +594,21 @@ QMap PropagateUploadFileCommon::headers() && !_deleteExisting) { // We add quotes because the owncloud server always adds quotes around the etag, and // csync_owncloud.c's owncloud_file_id always strips the quotes. - headers["If-Match"] = '"' + _item->_etag + '"'; + headers[QByteArrayLiteral("If-Match")] = '"' + _item->_etag + '"'; } // Set up a conflict file header pointing to the original file auto conflictRecord = propagator()->_journal->conflictRecord(_item->_file.toUtf8()); if (conflictRecord.isValid()) { - headers["OC-Conflict"] = "1"; + headers[QByteArrayLiteral("OC-Conflict")] = "1"; if (!conflictRecord.initialBasePath.isEmpty()) - headers["OC-ConflictInitialBasePath"] = conflictRecord.initialBasePath; + headers[QByteArrayLiteral("OC-ConflictInitialBasePath")] = conflictRecord.initialBasePath; if (!conflictRecord.baseFileId.isEmpty()) - headers["OC-ConflictBaseFileId"] = conflictRecord.baseFileId; + headers[QByteArrayLiteral("OC-ConflictBaseFileId")] = conflictRecord.baseFileId; if (conflictRecord.baseModtime != -1) - headers["OC-ConflictBaseMtime"] = QByteArray::number(conflictRecord.baseModtime); + headers[QByteArrayLiteral("OC-ConflictBaseMtime")] = QByteArray::number(conflictRecord.baseModtime); if (!conflictRecord.baseEtag.isEmpty()) - headers["OC-ConflictBaseEtag"] = conflictRecord.baseEtag; + headers[QByteArrayLiteral("OC-ConflictBaseEtag")] = conflictRecord.baseEtag; } return headers; diff --git a/src/libsync/propagateuploadng.cpp b/src/libsync/propagateuploadng.cpp index e141bcc867..b7b1afb6c6 100644 --- a/src/libsync/propagateuploadng.cpp +++ b/src/libsync/propagateuploadng.cpp @@ -504,17 +504,17 @@ void PropagateUploadFileNG::doFinalMove() auto headers = PropagateUploadFileCommon::headers(); // "If-Match applies to the source, but we are interested in comparing the etag of the destination - auto ifMatch = headers.take("If-Match"); + auto ifMatch = headers.take(QByteArrayLiteral("If-Match")); if (!ifMatch.isEmpty()) { - headers["If"] = "<" + destination.toUtf8() + "> ([" + ifMatch + "])"; + headers[QByteArrayLiteral("If")] = "<" + destination.toUtf8() + "> ([" + ifMatch + "])"; } if (!_transmissionChecksumHeader.isEmpty()) { headers[checkSumHeaderC] = _transmissionChecksumHeader; } - headers["OC-Total-Length"] = QByteArray::number(_bytesToUpload); - headers["OC-Total-File-Length"] = QByteArray::number(_item->_size); + headers[QByteArrayLiteral("OC-Total-Length")] = QByteArray::number(_bytesToUpload); + headers[QByteArrayLiteral("OC-Total-File-Length")] = QByteArray::number(_item->_size); - QUrl source = _zsyncSupported ? Utility::concatUrlPath(chunkUrl(), "/.file.zsync") : Utility::concatUrlPath(chunkUrl(), "/.file"); + QUrl source = _zsyncSupported ? Utility::concatUrlPath(chunkUrl(), QStringLiteral("/.file.zsync")) : Utility::concatUrlPath(chunkUrl(), QStringLiteral("/.file")); auto job = new MoveJob(propagator()->account(), source, destination, headers, this); _jobs.append(job); diff --git a/src/libsync/propagateuploadv1.cpp b/src/libsync/propagateuploadv1.cpp index c24e7b648c..3b37c37dc9 100644 --- a/src/libsync/propagateuploadv1.cpp +++ b/src/libsync/propagateuploadv1.cpp @@ -86,8 +86,8 @@ void PropagateUploadFileV1::startNextChunk() } quint64 fileSize = _item->_size; auto headers = PropagateUploadFileCommon::headers(); - headers["OC-Total-Length"] = QByteArray::number(fileSize); - headers["OC-Chunk-Size"] = QByteArray::number(quint64(chunkSize())); + headers[QByteArrayLiteral("OC-Total-Length")] = QByteArray::number(fileSize); + headers[QByteArrayLiteral("OC-Chunk-Size")] = QByteArray::number(quint64(chunkSize())); QString path = _item->_file; @@ -102,7 +102,7 @@ void PropagateUploadFileV1::startNextChunk() qCInfo(lcPropagateUpload) << "Upload chunk" << sendingChunk << "of" << _chunkCount << "transferid(remote)=" << transid; path += QString("-chunking-%1-%2-%3").arg(transid).arg(_chunkCount).arg(sendingChunk); - headers["OC-Chunked"] = "1"; + headers[QByteArrayLiteral("OC-Chunked")] = QByteArrayLiteral("1"); chunkStart = chunkSize() * quint64(sendingChunk); currentChunkSize = chunkSize();