mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-22 18:14:42 +01:00
update FindByPath
This commit is contained in:
@@ -787,20 +787,14 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
IsFolder = isFolder
|
||||
};
|
||||
|
||||
// Only use the database result if there's exactly one item, otherwise we run the risk of returning old data that hasn't been cleaned yet.
|
||||
var items = GetItemIds(query).Select(GetItemById).Where(i => i != null).ToArray();
|
||||
// If this returns multiple items it could be tricky figuring out which one is correct.
|
||||
// In most cases, the newest one will be and the others obsolete but not yet cleaned up
|
||||
|
||||
if (items.Length == 1)
|
||||
{
|
||||
return items[0];
|
||||
}
|
||||
|
||||
if (items.Length == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return RootFolder.FindByPath(path);
|
||||
return GetItemIds(query)
|
||||
.Select(GetItemById)
|
||||
.Where(i => i != null)
|
||||
.OrderByDescending(i => i.DateCreated)
|
||||
.FirstOrDefault();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user