aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2021-08-15 17:44:28 -0500
committerJP Dillingham <jpdillingham@gmail.com>2021-08-15 17:44:28 -0500
commitb02375273faa8ebfc81a681e9c07f0e1624b7bbf (patch)
treee3f179cad957524dbbb70c3f6c4fc7db62aabf7c /src
parentb72247c7cc29db6d14e30cccb4ca092a2d2d46ca (diff)
downloadslskd-b02375273faa8ebfc81a681e9c07f0e1624b7bbf.tar.gz
remove redundant checking for duplicates and bad aliases
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Application/SharedFileCache.cs22
1 files changed, 1 insertions, 21 deletions
diff --git a/src/slskd/Application/SharedFileCache.cs b/src/slskd/Application/SharedFileCache.cs
index 76abf77e..3f050086 100644
--- a/src/slskd/Application/SharedFileCache.cs
+++ b/src/slskd/Application/SharedFileCache.cs
@@ -131,22 +131,12 @@ namespace slskd
sw.Start();
Shares = OptionsMonitor.CurrentValue.Directories.Shared
+ .Select(share => Path.TrimEndingDirectorySeparator(share))
.ToHashSet() // remove duplicates
.Select(share => new Share(share)) // convert to Shares
.OrderByDescending(share => share.LocalPath.Length) // process subdirectories first. this allows them to be aliased separately from their parent
.ToList();
- // check for and warn about duplicates
- var duplicates = Shares.GroupBy(share => share.Mask + share.Alias).Where(group => group.Count() > 1);
-
- if (duplicates.Any())
- {
- foreach (var dupe in duplicates)
- {
- Log.Warning($"Overlapping shares: {string.Join(", ", dupe.Select(s => s.Raw))}. Use different alias(es) to disambiguate; downloads from one of these shares will fail.");
- }
- }
-
Log.Debug("Enumerating shared directories");
swSnapshot = sw.ElapsedMilliseconds;
@@ -362,16 +352,6 @@ namespace slskd
// split the alias from the path, and validate the alias
var groups = matches[0].Groups;
Alias = groups[1].Value;
-
- if (string.IsNullOrWhiteSpace(Alias))
- {
- throw new ShareAliasException($"Share aliases must not be null, empty or contain only whitespace (provided: {Alias})");
- }
- else if (Alias.Contains('\\') || Alias.Contains('/'))
- {
- throw new ShareAliasException($"Share aliases must not contain path separators '/' or '\\' (provided: {Alias})");
- }
-
LocalPath = groups[2].Value;
}
else