Skip to content

Commit

Permalink
Merge pull request #7602 from nextcloud/bugfix/updatePlaceHolderFiles
Browse files Browse the repository at this point in the history
dehydrate placeholder files using CfDehydratePlaceholder
  • Loading branch information
mgallien authored Dec 11, 2024
2 parents 5f93204 + ae0203c commit 96d890f
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions src/libsync/vfs/cfapi/cfapiwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -906,19 +906,15 @@ OCC::Result<OCC::Vfs::ConvertToPlaceholderResult, QString> OCC::CfApiWrapper::de

const auto info = findPlaceholderInfo(path);
if (info) {
CF_FILE_RANGE dehydrationRange;
dehydrationRange.StartingOffset.QuadPart = 0;
dehydrationRange.Length.QuadPart = size;

const qint64 result = CfUpdatePlaceholder(handleForPath(path).get(),
nullptr,
fileIdentity.data(),
sizeToDWORD(fileIdentitySize),
&dehydrationRange,
1,
CF_UPDATE_FLAG_MARK_IN_SYNC | CF_UPDATE_FLAG_DEHYDRATE,
nullptr,
nullptr);
LARGE_INTEGER largeStart, largeSize;
largeStart.QuadPart = 0;
largeSize.QuadPart = size;

const qint64 result = CfDehydratePlaceholder(handleForPath(path).get(),
largeStart,
largeSize,
CF_DEHYDRATE_FLAG_NONE,
0);

if (result != S_OK) {
const auto errorMessage = createErrorMessageForPlaceholderUpdateAndCreate(path, "Couldn't update placeholder info");
Expand Down

0 comments on commit 96d890f

Please sign in to comment.