mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-26 23:28:14 +03:00
Support old server which do not have the x-oc-mtime support
Owncloud 4.5 Or owncloud 5 with chunking Fixes https://github.com/owncloud/core/issues/8392
This commit is contained in:
parent
1b8d11182b
commit
9193286fc1
4 changed files with 34 additions and 5 deletions
|
@ -19,6 +19,7 @@
|
|||
#include "syncjournalfilerecord.h"
|
||||
#include "utility.h"
|
||||
#include "filesystem.h"
|
||||
#include "propagatorjobs.h"
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QFileInfo>
|
||||
#include <cmath>
|
||||
|
@ -299,15 +300,24 @@ void PropagateUploadFileQNAM::slotPutFinished()
|
|||
}
|
||||
|
||||
_item._etag = parseEtag(job->reply()->rawHeader("ETag"));
|
||||
_item._responseTimeStamp = job->responseTimestamp();
|
||||
|
||||
if (job->reply()->rawHeader("X-OC-MTime") != "accepted") {
|
||||
//FIXME
|
||||
// updateMTimeAndETag(uri.data(), _item._modtime);
|
||||
done(SyncFileItem::NormalError, tr("No X-OC-MTime extension, ownCloud 5 is required"));
|
||||
// X-OC-MTime is supported since owncloud 5.0. But not when chunking.
|
||||
// Normaly Owncloud 6 always put X-OC-MTime
|
||||
qDebug() << "Server do not support X-OC-MTime";
|
||||
PropagatorJob *newJob = new UpdateMTimeAndETagJob(_propagator, _item);
|
||||
QObject::connect(newJob, SIGNAL(completed(SyncFileItem)), this, SLOT(finalize()));
|
||||
QMetaObject::invokeMethod(newJob, "start");
|
||||
return;
|
||||
}
|
||||
finalize();
|
||||
}
|
||||
|
||||
|
||||
void PropagateUploadFileQNAM::finalize()
|
||||
{
|
||||
_item._requestDuration = _duration.elapsed();
|
||||
_item._responseTimeStamp = _job->responseTimestamp();
|
||||
|
||||
_propagator->_journal->setFileRecord(SyncJournalFileRecord(_item, _propagator->_localDir + _item._file));
|
||||
// Remove from the progress database:
|
||||
|
|
|
@ -91,7 +91,7 @@ private slots:
|
|||
void slotUploadProgress(qint64,qint64);
|
||||
void abort();
|
||||
void startNextChunk();
|
||||
|
||||
void finalize();
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -322,5 +322,15 @@ bool PropagateNeonJob::updateErrorFromSession(int neon_code, ne_request* req, in
|
|||
return false;
|
||||
}
|
||||
|
||||
void UpdateMTimeAndETagJob::start()
|
||||
{
|
||||
QScopedPointer<char, QScopedPointerPodDeleter> uri2(
|
||||
ne_path_escape((_propagator->_remoteDir + _item._renameTarget).toUtf8()));
|
||||
if (!updateMTimeAndETag(uri2.data(), _item._modtime))
|
||||
return;
|
||||
done(SyncFileItem::Success);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -108,4 +108,13 @@ public:
|
|||
};
|
||||
|
||||
|
||||
// To support older owncloud in the
|
||||
class UpdateMTimeAndETagJob : public PropagateNeonJob{
|
||||
Q_OBJECT
|
||||
public:
|
||||
UpdateMTimeAndETagJob (OwncloudPropagator* propagator, const SyncFileItem& item) : PropagateNeonJob(propagator, item) {}
|
||||
void start();
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue