Actually fix deleting profile images (hopefully)

This commit is contained in:
Patrick Barron
2020-06-12 22:47:09 -04:00
parent d0e2027b05
commit 103c9b7162
2 changed files with 7 additions and 6 deletions

View File

@@ -670,12 +670,9 @@ namespace Jellyfin.Server.Implementations.Users
/// <inheritdoc/>
public void ClearProfileImage(User user)
{
#nullable disable
// TODO: Remove these when User has nullable annotations
// Can't just set the value to null, as it hasn't been loaded yet, so EF Core wouldn't see the change
_dbProvider.CreateContext().Entry(user).Reference(u => u.ProfileImage).CurrentValue = null;
#nullable enable
var dbContext = _dbProvider.CreateContext();
dbContext.ImageInfos.Remove(user.ProfileImage);
dbContext.SaveChanges();
}
private static bool IsValidUsername(string name)