diff --git a/src/Umbraco.Web/PublishedCache/NuCache/DataSource/DatabaseDataSource.cs b/src/Umbraco.Web/PublishedCache/NuCache/DataSource/DatabaseDataSource.cs index 16f11aeafd..3c241d1c15 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/DataSource/DatabaseDataSource.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/DataSource/DatabaseDataSource.cs @@ -66,7 +66,7 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource public ContentNodeKit GetContentSource(IScope scope, int id) { var sql = ContentSourcesSelect(scope) - .Where(x => x.NodeObjectType == Constants.ObjectTypes.Document && x.NodeId == id) + .Where(x => x.NodeObjectType == Constants.ObjectTypes.Document && x.NodeId == id && !x.Trashed) .OrderBy(x => x.Level, x => x.SortOrder); var dto = scope.Database.Fetch(sql).FirstOrDefault(); @@ -76,7 +76,7 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource public IEnumerable GetAllContentSources(IScope scope) { var sql = ContentSourcesSelect(scope) - .Where(x => x.NodeObjectType == Constants.ObjectTypes.Document) + .Where(x => x.NodeObjectType == Constants.ObjectTypes.Document && !x.Trashed) .OrderBy(x => x.Level, x => x.SortOrder); return scope.Database.Query(sql).Select(CreateContentNodeKit); @@ -89,7 +89,7 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource .InnerJoin("x").On((left, right) => left.NodeId == right.NodeId || SqlText(left.Path, right.Path, (lp, rp) => $"({lp} LIKE {syntax.GetConcat(rp, "',%'")})"), aliasRight: "x")) - .Where(x => x.NodeObjectType == Constants.ObjectTypes.Document) + .Where(x => x.NodeObjectType == Constants.ObjectTypes.Document && !x.Trashed) .Where(x => x.NodeId == id, "x") .OrderBy(x => x.Level, x => x.SortOrder); @@ -99,7 +99,7 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource public IEnumerable GetTypeContentSources(IScope scope, IEnumerable ids) { var sql = ContentSourcesSelect(scope) - .Where(x => x.NodeObjectType == Constants.ObjectTypes.Document) + .Where(x => x.NodeObjectType == Constants.ObjectTypes.Document && !x.Trashed) .WhereIn(x => x.ContentTypeId, ids) .OrderBy(x => x.Level, x => x.SortOrder); @@ -137,7 +137,7 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource public ContentNodeKit GetMediaSource(IScope scope, int id) { var sql = MediaSourcesSelect(scope) - .Where(x => x.NodeObjectType == Constants.ObjectTypes.Media && x.NodeId == id) + .Where(x => x.NodeObjectType == Constants.ObjectTypes.Media && x.NodeId == id && !x.Trashed) .OrderBy(x => x.Level, x => x.SortOrder); var dto = scope.Database.Fetch(sql).FirstOrDefault(); @@ -147,7 +147,7 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource public IEnumerable GetAllMediaSources(IScope scope) { var sql = MediaSourcesSelect(scope) - .Where(x => x.NodeObjectType == Constants.ObjectTypes.Media) + .Where(x => x.NodeObjectType == Constants.ObjectTypes.Media && !x.Trashed) .OrderBy(x => x.Level, x => x.SortOrder); return scope.Database.Query(sql).Select(CreateMediaNodeKit); @@ -160,7 +160,7 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource .InnerJoin("x").On((left, right) => left.NodeId == right.NodeId || SqlText(left.Path, right.Path, (lp, rp) => $"({lp} LIKE {syntax.GetConcat(rp, "',%'")})"), aliasRight: "x")) - .Where(x => x.NodeObjectType == Constants.ObjectTypes.Media) + .Where(x => x.NodeObjectType == Constants.ObjectTypes.Media && !x.Trashed) .Where(x => x.NodeId == id, "x") .OrderBy(x => x.Level, x => x.SortOrder); @@ -170,7 +170,7 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource public IEnumerable GetTypeMediaSources(IScope scope, IEnumerable ids) { var sql = MediaSourcesSelect(scope) - .Where(x => x.NodeObjectType == Constants.ObjectTypes.Media) + .Where(x => x.NodeObjectType == Constants.ObjectTypes.Media && !x.Trashed) .WhereIn(x => x.ContentTypeId, ids) .OrderBy(x => x.Level, x => x.SortOrder);