!account->e2e()->isFolderEncrypted(remoteParentPath + '/')) {
startAfterIsEncryptedIsChecked();
} else {
+ const auto relativeRemotePath = _item->_file;
+ const auto slashPosition = relativeRemotePath.lastIndexOf('/');
+ const auto relativeRemoteParentPath = slashPosition >= 0 ? relativeRemotePath.left(slashPosition) : QString();
+
SyncJournalFileRecord parentRec;
- propagator()->_journal->getFileRecordByE2eMangledName(remoteParentPath, &parentRec);
- const auto parentPath = parentRec.isValid() ? parentRec._path : remoteParentPath;
+ propagator()->_journal->getFileRecordByE2eMangledName(relativeRemoteParentPath, &parentRec);
+ const auto parentPath = parentRec.isValid() ? parentRec._path : relativeRemoteParentPath;
_downloadEncryptedHelper = new PropagateDownloadEncrypted(propagator(), parentPath, _item, this);
connect(_downloadEncryptedHelper, &PropagateDownloadEncrypted::folderStatusNotEncrypted, [this] {
if (encryptedFilename == file.encryptedFilename) {
_encryptedInfo = file;
_item->_encryptedFileName = _item->_file;
- _item->_file = _localParentPath + QLatin1Char('/') + _encryptedInfo.originalFilename;
+ if (!_localParentPath.isEmpty()) {
+ _item->_file = _localParentPath + QLatin1Char('/') + _encryptedInfo.originalFilename;
+ } else {
+ _item->_file = _encryptedInfo.originalFilename;
+ }
qCDebug(lcPropagateDownloadEncrypted) << "Found matching encrypted metadata for file, starting download";
emit folderStatusEncrypted();
!account->e2e()->isFolderEncrypted(remoteParentPath + '/')) {
startLocalMkdir();
} else {
+ const auto relativeRemotePath = _item->_file;
+ const auto slashPosition = relativeRemotePath.lastIndexOf('/');
+ const auto relativeRemoteParentPath = slashPosition >= 0 ? relativeRemotePath.left(slashPosition) : QString();
+
SyncJournalFileRecord parentRec;
- propagator()->_journal->getFileRecordByE2eMangledName(remoteParentPath, &parentRec);
- const auto parentPath = parentRec.isValid() ? parentRec._path : remoteParentPath;
+ propagator()->_journal->getFileRecordByE2eMangledName(relativeRemoteParentPath, &parentRec);
+ const auto parentPath = parentRec.isValid() ? parentRec._path : relativeRemoteParentPath;
startDemanglingName(parentPath);
}
}