Skip to content

Commit 00394d5

Browse files
committed
fix(vfs/windows): update folder type when populated
after having populated the entries in a on-demand folder, update its type in database to ensure updated state only virtual folders have the on-demand feature enabled and that should happen only once as we always fully populated a folder Signed-off-by: Matthieu Gallien <[email protected]>
1 parent fc681b9 commit 00394d5

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

src/libsync/vfs/cfapi/cfapiwrapper.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,20 @@ void CALLBACK cfApiFetchPlaceHolders(const CF_CALLBACK_INFO *callbackInfo, const
592592
qCInfo(lcCfApiWrapper()) << "ls prop finished" << path << serverPath;
593593

594594
sendTransferInfo(newEntries);
595+
596+
auto newPlaceholdersResult = 0;
597+
const auto invokeFinalizeResult = QMetaObject::invokeMethod(vfs,
598+
[&newPlaceholdersResult, vfs, &newEntries, &serverPath] { return vfs->finalizeNewPlaceholders(newEntries, serverPath); },
599+
Qt::BlockingQueuedConnection,
600+
&newPlaceholdersResult);
601+
if (!invokeFinalizeResult) {
602+
qCritical(lcCfApiWrapper) << "Failed to finalize hydration job for" << path << requestId;
603+
sendTransferError();
604+
}
605+
606+
if (!newPlaceholdersResult) {
607+
sendTransferError();
608+
}
595609
}
596610

597611
void CALLBACK cfApiNotifyFileCloseCompletion(const CF_CALLBACK_INFO *callbackInfo, const CF_CALLBACK_PARAMETERS * /*callbackParameters*/)

src/libsync/vfs/cfapi/vfs_cfapi.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,26 @@ int VfsCfApi::finalizeHydrationJob(const QString &requestId)
529529
return HydrationJob::Status::Error;
530530
}
531531

532+
int VfsCfApi::finalizeNewPlaceholders(const QList<PlaceholderCreateInfo> &newEntries,
533+
const QString &pathString)
534+
{
535+
const auto &journal = params().journal;
536+
537+
auto folderRecord = SyncJournalFileRecord{};
538+
const auto fetchRecordDbResult = journal->getFileRecord(pathString, &folderRecord);
539+
if (!fetchRecordDbResult || !folderRecord.isValid()) {
540+
return 0;
541+
}
542+
543+
folderRecord._type = ItemTypeDirectory;
544+
const auto updateRecordDbResult = journal->setFileRecord(folderRecord);
545+
if (!updateRecordDbResult) {
546+
return 0;
547+
}
548+
549+
return 1;
550+
}
551+
532552
VfsCfApi::HydratationAndPinStates VfsCfApi::computeRecursiveHydrationAndPinStates(const QString &folderPath, const Optional<PinState> &basePinState)
533553
{
534554
Q_ASSERT(!folderPath.endsWith('/'));

src/libsync/vfs/cfapi/vfs_cfapi.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ class VfsCfApi : public Vfs
5656

5757
int finalizeHydrationJob(const QString &requestId);
5858

59+
int finalizeNewPlaceholders(const QList<OCC::PlaceholderCreateInfo> &newEntries,
60+
const QString &pathString);
61+
5962
public slots:
6063
void requestHydration(const QString &requestId, const QString &path);
6164
void fileStatusChanged(const QString &systemFileName, OCC::SyncFileStatus fileStatus) override;

0 commit comments

Comments
 (0)