diff options
| author | JP Dillingham <jp@dillingham.me> | 2026-06-04 22:52:37 -0500 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2026-06-04 22:52:37 -0500 |
| commit | ee41b93605a380480a5f7d826e7ae0602cd52de1 (patch) | |
| tree | 65ffc45abf0b9176107ea433993ccc20ad10923a /src | |
| parent | 1c14f93ec53559bb9de11fa3d25a2f8a0cc6e686 (diff) | |
| download | slskd-ee41b93605a380480a5f7d826e7ae0602cd52de1.tar.gz | |
wip
Diffstat (limited to 'src')
| -rw-r--r-- | src/slskd/Common/FileSafety.cs | 6 |
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); |
