From 49ae1fdc341f92d387f2208af1f8f332491dd660 Mon Sep 17 00:00:00 2001 From: edde746 <86283021+edde746@users.noreply.github.com> Date: Sat, 13 Jun 2026 13:25:26 +0200 Subject: [PATCH] fix(cache): use app-private image cache --- lib/main.dart | 7 +++++++ lib/services/image_cache_service.dart | 2 ++ 2 files changed, 9 insertions(+) diff --git a/lib/main.dart b/lib/main.dart index 49548321..c5f82e50 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -287,10 +287,17 @@ FutureOr _beforeSend(SentryEvent event, Hint _) { if (exceptions != null) { bool shouldDrop(SentryException e) { final v = e.value; + final lowerValue = v?.toLowerCase(); // Windows file-lock errors from cache manager cleanup if (e.type == 'FileSystemException' && v != null && v.contains('plexImageCache') && v.contains('errno = 32')) { return true; } + if (e.type == 'FileSystemException' && + lowerValue != null && + lowerValue.contains('cached_network_image_ce') && + (lowerValue.contains('lock failed') || lowerValue.contains('writefrom failed'))) { + return true; + } // Linux without DBus/NetworkManager if (e.type == 'DBusServiceUnknownException' || (v != null && v.contains('system_bus_socket'))) { return true; diff --git a/lib/services/image_cache_service.dart b/lib/services/image_cache_service.dart index 5ababaa5..3b8803cf 100644 --- a/lib/services/image_cache_service.dart +++ b/lib/services/image_cache_service.dart @@ -5,6 +5,7 @@ import 'dart:async'; // ignore: implementation_imports import 'package:cached_network_image_ce/src/cache/default_cache_manager.dart' as ce_cache; import 'package:http/http.dart' as http; +import 'package:path_provider/path_provider.dart'; import '../utils/media_server_http_client.dart'; @@ -31,6 +32,7 @@ class PlexImageCacheManager extends ce_cache.DefaultCacheManager { stalePeriod: const Duration(days: 14), maxNrOfCacheObjects: 3000, httpClientFactory: () => _SharedHttpClient(_artworkHttpClient.inner), + cacheDirectoryProvider: getApplicationCacheDirectory, ); }