added cache folder sweep check before file actions, preventing errors

This commit is contained in:
2026-08-07 21:36:09 +02:00
parent 62fa337188
commit b9cb1df473
4 changed files with 98 additions and 7 deletions
+7 -2
View File
@@ -7,6 +7,7 @@ import '../../utils/downloads/download_job.dart';
import '../../utils/downloads/download_manager.dart';
import '../../utils/haptics.dart';
import 'downloads_sheet.dart';
import 'stale_download_guard.dart';
/// Decides whether a just-finished download should open straight in the viewer.
///
@@ -198,9 +199,13 @@ class _DownloadTrayHostState extends State<DownloadTrayHost>
void _openJob(DownloadJob job) {
final path = job.localPath;
_manager.markOpened(job);
final ctx = AppRoutes.overlayContext;
if (path == null || ctx == null) return;
if (path == null || ctx == null) {
_manager.markOpened(job);
return;
}
if (!ensureDownloadStillExists(ctx, job)) return;
_manager.markOpened(job);
Haptics.success();
AppRoutes.openFileViewer(ctx, path, remoteFile: job.remoteFile);
}