diff --git a/Iceshrimp.Backend/Controllers/Web/ProfileController.cs b/Iceshrimp.Backend/Controllers/Web/ProfileController.cs index 5987a448..0e7c9c41 100644 --- a/Iceshrimp.Backend/Controllers/Web/ProfileController.cs +++ b/Iceshrimp.Backend/Controllers/Web/ProfileController.cs @@ -127,11 +127,8 @@ public class ProfileController( { var user = HttpContext.GetUserOrFail(); - var file = await db.Users - .IncludeCommonProperties() - .Where(p => p.Id == user.Id) - .Select(p => p.Avatar) - .FirstOrDefaultAsync() + var file = await db.DriveFiles + .FirstOrDefaultAsync(p => p.UserId == user.Id && p.UserAvatar != null) ?? throw GracefulException.RecordNotFound(); return new DriveFileResponse @@ -200,11 +197,8 @@ public class ProfileController( { var user = HttpContext.GetUserOrFail(); - var file = await db.Users - .IncludeCommonProperties() - .Where(p => p.Id == user.Id) - .Select(p => p.Banner) - .FirstOrDefaultAsync() + var file = await db.DriveFiles + .FirstOrDefaultAsync(p => p.UserId == user.Id && p.UserBanner != null) ?? throw GracefulException.RecordNotFound(); return new DriveFileResponse diff --git a/Iceshrimp.Backend/Core/Extensions/QueryableExtensions.cs b/Iceshrimp.Backend/Core/Extensions/QueryableExtensions.cs index 3dd9707d..3a251739 100644 --- a/Iceshrimp.Backend/Core/Extensions/QueryableExtensions.cs +++ b/Iceshrimp.Backend/Core/Extensions/QueryableExtensions.cs @@ -714,9 +714,7 @@ public static class QueryableExtensions public static IQueryable IncludeCommonProperties(this IQueryable query) { - return query.Include(p => p.UserProfile) - .Include(p => p.Avatar) - .Include(p => p.Banner); + return query.Include(p => p.UserProfile); } public static IQueryable IncludeCommonProperties(this IQueryable query)