Skip to content

Commit aec2014

Browse files
committed
fix(attachments): ensure directory existence on local storage before saving file
1 parent c6a93ae commit aec2014

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

packages/powersync_attachments_helper/lib/src/local_storage_adapter.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import 'package:path_provider/path_provider.dart';
55
/// Storage adapter for local storage
66
class LocalStorageAdapter {
77
Future<File> saveFile(String fileUri, Uint8List data) async {
8+
await makeDir(fileUri);
89
final file = File(fileUri);
910
return await file.writeAsBytes(data);
1011
}
@@ -36,6 +37,7 @@ class LocalStorageAdapter {
3637
}
3738

3839
Future<void> copyFile(String sourceUri, String targetUri) async {
40+
await makeDir(targetUri);
3941
File file = File(sourceUri);
4042
await file.copy(targetUri);
4143
}

0 commit comments

Comments
 (0)