From 3279bc7578c110e1240cb45663241d0937f3e8db Mon Sep 17 00:00:00 2001 From: edde746 <86283021+edde746@users.noreply.github.com> Date: Thu, 26 Feb 2026 00:01:55 +0100 Subject: [PATCH] fix: sanitize dots in download filenames close #556 --- lib/services/download_storage_service.dart | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/services/download_storage_service.dart b/lib/services/download_storage_service.dart index 0c6d84c1..4ca77b81 100644 --- a/lib/services/download_storage_service.dart +++ b/lib/services/download_storage_service.dart @@ -222,7 +222,11 @@ class DownloadStorageService { String _sanitizeFileName(String name) { // Remove invalid filesystem characters: < > : " / \ | ? * // Also remove leading/trailing whitespace and dots - return name.replaceAll(RegExp(r'[<>:"/\\|?*]'), '').replaceAll(RegExp(r'^\.+|\.+$'), '').trim(); + return name + .replaceAll(RegExp(r'[<>:"/\\|?*]'), '') + .replaceAll(RegExp(r'^\.+|\.+$'), '') + .replaceAll('.', '_') + .trim(); } /// Ensure a directory exists, creating it if necessary