From ee41b93605a380480a5f7d826e7ae0602cd52de1 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Thu, 4 Jun 2026 22:52:37 -0500 Subject: wip --- src/slskd/Common/FileSafety.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/slskd/Common/FileSafety.cs b/src/slskd/Common/FileSafety.cs index 73dd4b40..bf81da0e 100644 --- a/src/slskd/Common/FileSafety.cs +++ b/src/slskd/Common/FileSafety.cs @@ -432,11 +432,13 @@ public static class FileSafety // flip slashes the correct way path = LocalizePath(path, os); - // for each segment, drop nulls (created by double slashes), sanitize, and replace traversal strings + // for each segment, drop nulls (created by double slashes), sanitize, replace traversal strings, + // and drop any segments that sanitization reduced to empty (e.g. a single invalid char with '.' replacement) var segments = path .Split('/', '\\') .Where(s => s is not "") - .Select(s => SanitizePathSegment(s, replacement, os)); + .Select(s => SanitizePathSegment(s, replacement, os)) + .Where(s => s is not ""); var newPath = string.Join(sep, segments); -- cgit v1.2.3