Skip to content

Commit b348b84

Browse files
authored
Lock appropriate tree for media operations (#19422)
The MediaService currently locks the ContentTree for GetPagedOfType(s) operations, but it's querying the MediaTree. This ensures we lock the correct tree.
1 parent 7f4a8d5 commit b348b84

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Umbraco.Core/Services/MediaService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ public IEnumerable<IMedia> GetPagedOfType(int contentTypeId, long pageIndex, int
418418
}
419419

420420
using ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true);
421-
scope.ReadLock(Constants.Locks.ContentTree);
421+
scope.ReadLock(Constants.Locks.MediaTree);
422422
return _mediaRepository.GetPage(Query<IMedia>()?.Where(x => x.ContentTypeId == contentTypeId), pageIndex, pageSize, out totalRecords, filter, ordering);
423423
}
424424

@@ -441,7 +441,7 @@ public IEnumerable<IMedia> GetPagedOfTypes(int[] contentTypeIds, long pageIndex,
441441
}
442442

443443
using ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true);
444-
scope.ReadLock(Constants.Locks.ContentTree);
444+
scope.ReadLock(Constants.Locks.MediaTree);
445445
return _mediaRepository.GetPage(
446446
Query<IMedia>()?.Where(x => contentTypeIds.Contains(x.ContentTypeId)), pageIndex, pageSize, out totalRecords, filter, ordering);
447447
}

0 commit comments

Comments
 (0)