aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MediaBrowser.Api/Library/LibraryHelpers.cs7
-rw-r--r--MediaBrowser.Controller/Entities/BaseItem.cs12
-rw-r--r--MediaBrowser.Controller/Entities/CollectionFolder.cs13
-rw-r--r--MediaBrowser.Server.Implementations/Library/LibraryManager.cs12
4 files changed, 31 insertions, 13 deletions
diff --git a/MediaBrowser.Api/Library/LibraryHelpers.cs b/MediaBrowser.Api/Library/LibraryHelpers.cs
index ff0915d78..d3b7861a6 100644
--- a/MediaBrowser.Api/Library/LibraryHelpers.cs
+++ b/MediaBrowser.Api/Library/LibraryHelpers.cs
@@ -203,7 +203,6 @@ namespace MediaBrowser.Api.Library
{
// Example: D:\Movies is the existing path
// D:\ cannot be added
- // Neither can D:\Movies\Kids
// A D:\Movies duplicate is ok here since that will be caught later
if (newPath.Equals(existingPath, StringComparison.OrdinalIgnoreCase))
@@ -211,12 +210,6 @@ namespace MediaBrowser.Api.Library
return true;
}
- // Validate the D:\Movies\Kids scenario
- if (newPath.StartsWith(existingPath.TrimEnd(Path.DirectorySeparatorChar) + Path.DirectorySeparatorChar, StringComparison.OrdinalIgnoreCase))
- {
- return false;
- }
-
// Validate the D:\ scenario
if (existingPath.StartsWith(newPath.TrimEnd(Path.DirectorySeparatorChar) + Path.DirectorySeparatorChar, StringComparison.OrdinalIgnoreCase))
{
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs
index ac8688f77..898280110 100644
--- a/MediaBrowser.Controller/Entities/BaseItem.cs
+++ b/MediaBrowser.Controller/Entities/BaseItem.cs
@@ -384,6 +384,18 @@ namespace MediaBrowser.Controller.Entities
var flattenFolderDepth = isPhysicalRoot ? 2 : 0;
args.FileSystemDictionary = FileData.GetFilteredFileSystemEntries(args.Path, Logger, flattenFolderDepth: flattenFolderDepth, args: args, resolveShortcuts: isPhysicalRoot || args.IsVf);
+
+ // Need to remove subpaths that may have been resolved from shortcuts
+ // Example: if \\server\movies exists, then strip out \\server\movies\action
+ if (isPhysicalRoot)
+ {
+ var paths = args.FileSystemDictionary.Keys.ToList();
+
+ foreach (var subPath in paths.Where(subPath => paths.Any(i => subPath.StartsWith(i.TrimEnd(System.IO.Path.DirectorySeparatorChar) + System.IO.Path.DirectorySeparatorChar, StringComparison.OrdinalIgnoreCase))))
+ {
+ args.FileSystemDictionary.Remove(subPath);
+ }
+ }
}
//update our dates
diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.cs
index 64e5da92e..723ab4756 100644
--- a/MediaBrowser.Controller/Entities/CollectionFolder.cs
+++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs
@@ -1,5 +1,4 @@
using MediaBrowser.Common.Extensions;
-using MediaBrowser.Model.Entities;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
@@ -74,23 +73,25 @@ namespace MediaBrowser.Controller.Entities
{
get
{
- IEnumerable<Guid> folderIds;
+ Dictionary<Guid,Guid> folderIds;
try
{
// Accessing ResolveArgs could involve file system access
- folderIds = ResolveArgs.PhysicalLocations.Select(f => (f.GetMBId(typeof(Folder))));
+ folderIds = ResolveArgs.PhysicalLocations
+ .Select(f => (f.GetMBId(typeof(Folder))))
+ .ToDictionary(i => i);
}
catch (IOException ex)
{
Logger.ErrorException("Error creating FolderIds for {0}", ex, Path);
- folderIds = new Guid[] {};
+ folderIds = new Dictionary<Guid, Guid>();
}
var ourChildren =
- LibraryManager.RootFolder.Children.OfType<Folder>()
- .Where(i => folderIds.Contains(i.Id))
+ LibraryManager.RootFolder.RecursiveChildren.OfType<Folder>()
+ .Where(i => folderIds.ContainsKey(i.Id))
.SelectMany(c => c.Children);
return new ConcurrentDictionary<Guid,BaseItem>(ourChildren.ToDictionary(i => i.Id));
diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
index 13857a656..af0212738 100644
--- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
+++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
@@ -430,6 +430,18 @@ namespace MediaBrowser.Server.Implementations.Library
var flattenFolderDepth = isPhysicalRoot ? 2 : 0;
args.FileSystemDictionary = FileData.GetFilteredFileSystemEntries(args.Path, _logger, flattenFolderDepth: flattenFolderDepth, args: args, resolveShortcuts: isPhysicalRoot || args.IsVf);
+
+ // Need to remove subpaths that may have been resolved from shortcuts
+ // Example: if \\server\movies exists, then strip out \\server\movies\action
+ if (isPhysicalRoot)
+ {
+ var paths = args.FileSystemDictionary.Keys.ToList();
+
+ foreach (var subPath in paths.Where(subPath => paths.Any(i => subPath.StartsWith(i.TrimEnd(System.IO.Path.DirectorySeparatorChar) + System.IO.Path.DirectorySeparatorChar, StringComparison.OrdinalIgnoreCase))))
+ {
+ args.FileSystemDictionary.Remove(subPath);
+ }
+ }
}
// Check to see if we should resolve based on our contents