aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2026-06-04 22:52:37 -0500
committerJP Dillingham <jp@dillingham.me>2026-06-04 22:52:37 -0500
commitee41b93605a380480a5f7d826e7ae0602cd52de1 (patch)
tree65ffc45abf0b9176107ea433993ccc20ad10923a /src
parent1c14f93ec53559bb9de11fa3d25a2f8a0cc6e686 (diff)
downloadslskd-ee41b93605a380480a5f7d826e7ae0602cd52de1.tar.gz
wip
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Common/FileSafety.cs6
1 files changed, 4 insertions, 2 deletions
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);