QMap<QByteArray, QByteArray> PropagateUploadFileCommon::headers()
{
QMap<QByteArray, QByteArray> 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
&& !_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;
}
if (_uploadEncryptedHelper && !_uploadEncryptedHelper->_folderToken.isEmpty()) {
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"] = "<" + QUrl::toPercentEncoding(destination, "/") + "> ([" + ifMatch + "])";
+ headers[QByteArrayLiteral("If")] = "<" + QUrl::toPercentEncoding(destination, "/") + "> ([" + ifMatch + "])";
}
if (!_transmissionChecksumHeader.isEmpty()) {
qCInfo(lcPropagateUpload) << destination << _transmissionChecksumHeader;
headers[checkSumHeaderC] = _transmissionChecksumHeader;
}
- headers["OC-Total-Length"] = QByteArray::number(fileSize);
+ headers[QByteArrayLiteral("OC-Total-Length")] = QByteArray::number(fileSize);
auto job = new MoveJob(propagator()->account(), Utility::concatUrlPath(chunkUrl(), "/.file"),
destination, headers, this);
}
quint64 fileSize = _fileToUpload._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 = _fileToUpload._file;
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();