mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-05-31 04:48:27 +01:00
Properly remove profile images
This commit is contained in:
@@ -22,7 +22,6 @@ using MediaBrowser.Model.Cryptography;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Events;
|
||||
using MediaBrowser.Model.Users;
|
||||
using Microsoft.EntityFrameworkCore.Internal;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Jellyfin.Server.Implementations.Users
|
||||
@@ -668,6 +667,16 @@ namespace Jellyfin.Server.Implementations.Users
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
private static bool IsValidUsername(string name)
|
||||
{
|
||||
// This is some regex that matches only on unicode "word" characters, as well as -, _ and @
|
||||
|
||||
Reference in New Issue
Block a user