Skip to content

Commit 6d30574

Browse files
committed
In case when removed rank > 0 deltas, we still had a file diff - unhandled case when filediff exists in DB
1 parent 4ade8b4 commit 6d30574

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

server/mergin/sync/files.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ def to_data_delta(self):
287287
version=self.version,
288288
)
289289
if self.diffs:
290-
result.diff = self.diffs[0].id
290+
result.diff = None
291291
return result
292292

293293

server/mergin/sync/models.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1359,6 +1359,11 @@ def create_checkpoint(
13591359
# Patch the delta with the path to the new diff checkpoint
13601360
item.diff = checkpoint_diff.path
13611361
db.session.add(checkpoint_diff)
1362+
else:
1363+
# checkpoint already exists, just patch the delta with the path to the existing diff checkpoint
1364+
# this could happen when file diff exists but dela was missing
1365+
# this allowing us to remove rank > 0 delta checkpoints in case of inconsistencies
1366+
item.diff = existing_diff_checkpoint.path
13621367

13631368
checkpoint_delta = ProjectVersionDelta(
13641369
project_id=project_id,

0 commit comments

Comments
 (0)