fix(storage): recover from unwritable download folders

This commit is contained in:
zarzet
2026-07-29 02:03:09 +07:00
parent 662558e3e6
commit 8dcf7fa998
9 changed files with 489 additions and 64 deletions
+47
View File
@@ -52,6 +52,53 @@ void main() {
});
});
group('storage write failure detection', () {
test('recognizes typed and common Android filesystem failures', () {
expect(
isStorageWriteFailure(
errorType: 'permission',
errorMessage: 'provider-specific text',
),
isTrue,
);
expect(
isStorageWriteFailure(
errorMessage:
'failed to create file: open /storage/song.flac.partial: '
'operation not permitted',
),
isTrue,
);
expect(
isStorageWriteFailure(
errorMessage:
'Native finalization failed: failed to publish deferred SAF output',
),
isTrue,
);
});
test(
'does not mistake provider or network failures for storage errors',
() {
expect(
isStorageWriteFailure(
errorType: 'api_error',
errorMessage: 'HTTP 404 for /download',
),
isFalse,
);
expect(
isStorageWriteFailure(
errorType: 'network',
errorMessage: 'Connection reset by peer',
),
isFalse,
);
},
);
});
group('local library incremental scan', () {
test('rescans legacy metadata rows exactly once', () {
expect(