diff --git a/src/common/syncjournaldb.cpp b/src/common/syncjournaldb.cpp index 33f3f49ff..e613358a6 100644 --- a/src/common/syncjournaldb.cpp +++ b/src/common/syncjournaldb.cpp @@ -442,12 +442,13 @@ bool SyncJournalDb::checkConnect() return sqlFail("Create table blacklist", createQuery); } - createQuery.prepare("CREATE TABLE IF NOT EXISTS poll(" + createQuery.prepare("CREATE TABLE IF NOT EXISTS async_poll(" "path VARCHAR(4096)," "modtime INTEGER(8)," + "filesize BIGINT," "pollpath VARCHAR(4096));"); if (!createQuery.exec()) { - return sqlFail("Create table poll", createQuery); + return sqlFail("Create table async_poll", createQuery); } // create the selectivesync table. @@ -1722,7 +1723,7 @@ QVector SyncJournalDb::getPollInfos() if (!checkConnect()) return res; - SqlQuery query("SELECT path, modtime, pollpath FROM poll", _db); + SqlQuery query("SELECT path, modtime, filesize, pollpath FROM async_poll", _db); if (!query.exec()) { return res; @@ -1732,7 +1733,8 @@ QVector SyncJournalDb::getPollInfos() PollInfo info; info._file = query.stringValue(0); info._modtime = query.int64Value(1); - info._url = query.stringValue(2); + info._fileSize = query.int64Value(2); + info._url = query.stringValue(3); res.append(info); } @@ -1749,14 +1751,15 @@ void SyncJournalDb::setPollInfo(const SyncJournalDb::PollInfo &info) if (info._url.isEmpty()) { qCDebug(lcDb) << "Deleting Poll job" << info._file; - SqlQuery query("DELETE FROM poll WHERE path=?", _db); + SqlQuery query("DELETE FROM async_poll WHERE path=?", _db); query.bindValue(1, info._file); query.exec(); } else { - SqlQuery query("INSERT OR REPLACE INTO poll (path, modtime, pollpath) VALUES( ? , ? , ? )", _db); + SqlQuery query("INSERT OR REPLACE INTO async_poll (path, modtime, filesize, pollpath) VALUES( ? , ? , ? , ? )", _db); query.bindValue(1, info._file); query.bindValue(2, info._modtime); - query.bindValue(3, info._url); + query.bindValue(3, info._fileSize); + query.bindValue(4, info._url); query.exec(); } } diff --git a/src/common/syncjournaldb.h b/src/common/syncjournaldb.h index 13596fb0a..cf0cf61a3 100644 --- a/src/common/syncjournaldb.h +++ b/src/common/syncjournaldb.h @@ -114,6 +114,7 @@ public: QString _file; // The relative path of a file QString _url; // the poll url. (This pollinfo is invalid if _url is empty) qint64 _modtime; // The modtime of the file being uploaded + qint64 _fileSize; }; DownloadInfo getDownloadInfo(const QString &file); diff --git a/src/libsync/owncloudpropagator.cpp b/src/libsync/owncloudpropagator.cpp index a1d60eada..b8fd817ad 100644 --- a/src/libsync/owncloudpropagator.cpp +++ b/src/libsync/owncloudpropagator.cpp @@ -1008,6 +1008,7 @@ void CleanupPollsJob::start() SyncFileItemPtr item(new SyncFileItem); item->_file = info._file; item->_modtime = info._modtime; + item->_size = info._fileSize; auto *job = new PollJob(_account, info._url, item, _journal, _localPath, this); connect(job, &PollJob::finishedSignal, this, &CleanupPollsJob::slotPollFinished); job->start(); diff --git a/src/libsync/propagateupload.cpp b/src/libsync/propagateupload.cpp index 47b6fc1d3..77f4f73f7 100644 --- a/src/libsync/propagateupload.cpp +++ b/src/libsync/propagateupload.cpp @@ -592,6 +592,7 @@ void PropagateUploadFileCommon::startPollJob(const QString &path) info._file = _item->_file; info._url = path; info._modtime = _item->_modtime; + info._fileSize = _item->_size; propagator()->_journal->setPollInfo(info); propagator()->_journal->commit("add poll info"); propagator()->_activeJobList.append(this);