Release file lock by closing InputStream

Fix issue where backup file remained locked by closing InputStream after use
This commit is contained in:
NBA2K1 2025-06-20 21:50:47 +02:00
parent 2b8625bf0e
commit a5168a6a2b

View file

@ -62,6 +62,8 @@ void doRestore(Ref ref, {required String path, required BuildContext context}) {
}
} catch (e, s) {
botToast('$e\n$s');
} finally {
inputStream.close();
}
}
@ -379,9 +381,9 @@ void restoreKotatsuBackup(Ref ref, Archive archive) {
@riverpod
void restoreTachiBkBackup(Ref ref, String path, BackupType bkType) {
final content = GZipDecoder().decodeBytes(
InputFileStream(path).toUint8List(),
);
final inputStream = InputFileStream(path);
final content = GZipDecoder().decodeBytes(inputStream.toUint8List());
inputStream.close();
final backup = BackupMihon.fromBuffer(content);
List<Category> cats = [];
isar.writeTxnSync(() {