Fix file name sanitising to remove trailing dots. Close #322

This commit is contained in:
2025-04-22 20:29:18 +08:00
parent 62e4056f4a
commit 3131ce52a7

View File

@@ -132,7 +132,7 @@ extension DirectoryExtension on Directory {
/// Sanitize the file name. Remove invalid characters and trim the file name.
String sanitizeFileName(String fileName, {String? dir, int? maxLength}) {
if (fileName.endsWith('.')) {
while (fileName.endsWith('.')) {
fileName = fileName.substring(0, fileName.length - 1);
}
var length = maxLength ?? 255;