Fixed: Given -1 MediaService returns all descendant media
It returned the entire media tree given the ID -1, changing this so it returns children below root instead
This commit is contained in:
@@ -394,12 +394,8 @@ namespace Umbraco.Core.Services
|
||||
using (var repository = RepositoryFactory.CreateMediaRepository(UowProvider.GetUnitOfWork()))
|
||||
{
|
||||
var query = Query<IMedia>.Builder;
|
||||
//if the id is -1, then just get all
|
||||
if (id != -1)
|
||||
{
|
||||
query.Where(x => x.ParentId == id);
|
||||
}
|
||||
|
||||
query.Where(x => x.ParentId == id);
|
||||
|
||||
long total;
|
||||
var medias = repository.GetPagedResultsByQuery(query, pageIndex, pageSize, out total, orderBy, orderDirection, filter);
|
||||
|
||||
@@ -427,11 +423,8 @@ namespace Umbraco.Core.Services
|
||||
using (var repository = RepositoryFactory.CreateMediaRepository(UowProvider.GetUnitOfWork()))
|
||||
{
|
||||
var query = Query<IMedia>.Builder;
|
||||
//if the id is -1, then just get all
|
||||
if (id != -1)
|
||||
{
|
||||
query.Where(x => x.ParentId == id);
|
||||
}
|
||||
query.Where(x => x.ParentId == id);
|
||||
|
||||
var medias = repository.GetPagedResultsByQuery(query, pageIndex, pageSize, out totalChildren, orderBy, orderDirection, filter);
|
||||
|
||||
return medias;
|
||||
|
||||
Reference in New Issue
Block a user