nextcloud-desktop/src/libsync/propagatedownloadencrypted.h
Daniel Nicoletti d5ab642e46 Fix sync status running when encryption data is missing
When a file on the server of an encrypted folder do
not have a matching entry on the JSON metadata, we
need to report an error and be done with the job
so that Sync status is not "running".

This eventually should cause the file to be removed
from the server as it can not be recovered anymore.
2018-04-09 13:23:52 +02:00

47 lines
1 KiB
C++

#ifndef PROPAGATEDOWNLOADENCRYPTED_H
#define PROPAGATEDOWNLOADENCRYPTED_H
#include <QObject>
#include <QFileInfo>
#include "syncfileitem.h"
#include "owncloudpropagator.h"
#include "clientsideencryption.h"
class QJsonDocument;
namespace OCC {
class PropagateDownloadEncrypted : public QObject {
Q_OBJECT
public:
PropagateDownloadEncrypted(OwncloudPropagator *propagator, SyncFileItemPtr item);
void start();
void checkFolderId(const QStringList &list);
bool decryptFile(QFile& tmpFile);
QString errorString() const;
public slots:
void checkFolderEncryptedStatus();
void checkFolderEncryptedMetadata(const QJsonDocument &json);
void folderStatusReceived(const QString &folder, bool isEncrypted);
void folderStatusError(int httpErrorCode);
void folderIdError();
signals:
void folderStatusEncrypted();
void folderStatusNotEncrypted();
void failed();
void decryptionFinished();
private:
OwncloudPropagator *_propagator;
SyncFileItemPtr _item;
QFileInfo _info;
EncryptedFile _encryptedInfo;
QString _errorString;
};
}
#endif