Skip to content

Commit 08b125c

Browse files
icolesimolus3
authored andcommitted
fix(attachments-storage-react-native): await File.move before reading size in moveFile
1 parent 92a6ec7 commit 08b125c

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

.changeset/fix-move-file-race.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@powersync/attachments-storage-react-native': patch
3+
---
4+
5+
Fix `ExpoFileSystemStorageAdapter.moveFile` returning a stale size.

packages/attachments-storage-react-native/src/ExpoFileSystemStorageAdapter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ To use the Expo File System attachment adapter please install expo-file-system (
101101
if (target.exists) {
102102
target.delete();
103103
}
104-
new this.File(sourceUri).move(target);
104+
await new this.File(sourceUri).move(target);
105105
}
106106
return new this.File(targetUri).size ?? 0;
107107
}

0 commit comments

Comments
 (0)