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:
Per Ploug
2015-10-21 09:49:45 +02:00
parent 20d676e667
commit 0454c54d1c

View File

@@ -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;