diff --git a/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Assets/MongoAssetRepository.cs b/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Assets/MongoAssetRepository.cs index 768854381..162f433ce 100644 --- a/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Assets/MongoAssetRepository.cs +++ b/backend/src/Squidex.Domain.Apps.Entities.MongoDb/Assets/MongoAssetRepository.cs @@ -129,27 +129,27 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.Assets } } - public async Task FindAssetBySlugAsync(DomainId appId, string slug) + public async Task> QueryByHashAsync(DomainId appId, string hash) { using (Profiler.TraceMethod()) { - var assetEntity = - await Collection.Find(x => x.IndexedAppId == appId && !x.IsDeleted && x.Slug == slug) - .FirstOrDefaultAsync(); + var assetEntities = + await Collection.Find(x => x.IndexedAppId == appId && !x.IsDeleted && x.FileHash == hash) + .ToListAsync(); - return assetEntity; + return assetEntities.OfType().ToList(); } } - public async Task> QueryByHashAsync(DomainId appId, string hash) + public async Task FindAssetBySlugAsync(DomainId appId, string slug) { using (Profiler.TraceMethod()) { - var assetEntities = - await Collection.Find(x => x.IndexedAppId == appId && !x.IsDeleted && x.FileHash == hash) - .ToListAsync(); + var assetEntity = + await Collection.Find(x => x.IndexedAppId == appId && !x.IsDeleted && x.Slug == slug) + .FirstOrDefaultAsync(); - return assetEntities.OfType().ToList(); + return assetEntity; } }