added cache folder sweep check before file actions, preventing errors
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user