aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2022-09-04 12:56:19 -0500
committerGitHub <noreply@github.com>2022-09-04 12:56:19 -0500
commitd3d0165fcc83104215fd6df7321fac2309e68e58 (patch)
tree749fa5c99b5dccc10fc423dc6198e9b7ab669cfd /src
parent05ce3650a2afbfbc08c3903dccdec4a3526a3cd1 (diff)
parent731b371d25e84536745f3987cc83344d8e7e0262 (diff)
downloadslskd-d3d0165fcc83104215fd6df7321fac2309e68e58.tar.gz
Merge pull request #630 from slskd/slash-replacement
Ignore files and directories containing backslashes while scanning. Warn users if files are ignored.
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Shares/SharedFileCache.cs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/slskd/Shares/SharedFileCache.cs b/src/slskd/Shares/SharedFileCache.cs
index 3a41f61b..9902c951 100644
--- a/src/slskd/Shares/SharedFileCache.cs
+++ b/src/slskd/Shares/SharedFileCache.cs
@@ -253,6 +253,12 @@ namespace slskd.Shares
{
Log.Debug("Starting scan of {Directory} ({Current}/{Total})", directory, current + 1, unmaskedDirectories.Count);
+ if (Path.DirectorySeparatorChar == '/' && directory.Contains('\\'))
+ {
+ Log.Warning("Directory name {Directory} contains one or more backslashes, which are not currently supported. This directory will not be shared.", directory);
+ continue;
+ }
+
var addedFiles = 0L;
var filteredFiles = 0L;
@@ -287,6 +293,12 @@ namespace slskd.Shares
continue;
}
+ if (Path.DirectorySeparatorChar == '/' && file.Value.Filename.Contains('\\'))
+ {
+ Log.Warning("Filename {Filename} contains one or more backslashes, which are not currently supported. This file will not be shared.", file.Value.Filename);
+ continue;
+ }
+
if (files.ContainsKey(file.Key))
{
Log.Warning($"File {file.Key} shared in directory {directory} has already been cached. This is probably a misconfiguration of the shared directories (is a subdirectory being re-shared?).");