QueryMode recurseQueryLocal, QueryMode recurseQueryServer)
{
// Adjust target path for virtual-suffix files
- if (item->_type == ItemTypeVirtualFile && isVfsWithSuffix()) {
- addVirtualFileSuffix(path._target);
- if (item->_instruction == CSYNC_INSTRUCTION_RENAME)
+ if (isVfsWithSuffix()) {
+ if (item->_type == ItemTypeVirtualFile) {
+ addVirtualFileSuffix(path._target);
+ if (item->_instruction == CSYNC_INSTRUCTION_RENAME)
+ addVirtualFileSuffix(item->_renameTarget);
+ else
+ addVirtualFileSuffix(item->_file);
+ }
+ if (item->_type == ItemTypeVirtualFileDehydration
+ && item->_instruction == CSYNC_INSTRUCTION_NEW) {
+ item->_renameTarget = item->_file;
addVirtualFileSuffix(item->_renameTarget);
- else
- addVirtualFileSuffix(item->_file);
+ }
}
if (path._original != path._target && (item->_instruction == CSYNC_INSTRUCTION_UPDATE_METADATA || item->_instruction == CSYNC_INSTRUCTION_NONE)) {
qCDebug(lcPropagateDownload) << "dehydrating file" << _item->_file;
_item->_type = ItemTypeVirtualFile; // Needed?
vfs->dehydratePlaceholder(*_item);
- propagator()->_journal->deleteFileRecord(_item->_file);
+ propagator()->_journal->deleteFileRecord(_item->_originalFile);
+ if (!_item->_renameTarget.isEmpty())
+ _item->_file = _item->_renameTarget;
updateMetadata(false);
return;
}
// Variables useful for everybody
QString _file;
+ // for renames: the name _file should be renamed to
+ // for dehydrations: the name _file should become after dehydration (like adding a suffix)
QString _renameTarget;
/// Whether there's end to end encryption on this file.
{
QFile::remove(_setupParams.filesystemPath + item._file);
SyncFileItem virtualItem(item);
- virtualItem._file.append(fileSuffix());
+ virtualItem._file = item._renameTarget;
createPlaceholder(virtualItem);
}
return !fakeFolder.currentLocalState().find(path)
&& fakeFolder.currentLocalState().find(placeholder);
};
+ auto hasDehydratedDbEntries = [&](const QString &path) {
+ SyncJournalFileRecord normal, suffix;
+ fakeFolder.syncJournal().getFileRecord(path, &normal);
+ fakeFolder.syncJournal().getFileRecord(path + ".nextcloud", &suffix);
+ return !normal.isValid() && suffix.isValid() && suffix._type == ItemTypeVirtualFile;
+ };
QVERIFY(isDehydrated("A/a1"));
+ QVERIFY(hasDehydratedDbEntries("A/a1"));
QVERIFY(isDehydrated("A/a2"));
+ QVERIFY(hasDehydratedDbEntries("A/a2"));
QVERIFY(!fakeFolder.currentLocalState().find("B/b1"));
QVERIFY(!fakeFolder.currentRemoteState().find("B/b1"));
QVERIFY(!fakeFolder.currentLocalState().find("B/b2"));
QVERIFY(!fakeFolder.currentRemoteState().find("B/b2"));
QVERIFY(isDehydrated("B/b3"));
+ QVERIFY(hasDehydratedDbEntries("B/b3"));
QVERIFY(itemInstruction(completeSpy, "B/b2", CSYNC_INSTRUCTION_REMOVE));
QVERIFY(itemInstruction(completeSpy, "B/b3.nextcloud", CSYNC_INSTRUCTION_NEW));