fix: sanitize dots in download filenames

close #556
This commit is contained in:
edde746
2026-02-26 00:02:14 +01:00
parent 383351d769
commit 3279bc7578
+5 -1
View File
@@ -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