Merge pull request #3591 from crobibero/clear-existing-image

Remove profile image before setting new
This commit is contained in:
Anthony Lavado 2020-07-19 11:21:08 -04:00 committed by GitHub
commit 6ab4493ecb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -895,6 +895,11 @@ namespace MediaBrowser.Api.Images
// Handle image/png; charset=utf-8
mimeType = mimeType.Split(';').FirstOrDefault();
var userDataPath = Path.Combine(ServerConfigurationManager.ApplicationPaths.UserConfigurationDirectoryPath, user.Username);
if (user.ProfileImage != null)
{
_userManager.ClearProfileImage(user);
}
user.ProfileImage = new Jellyfin.Data.Entities.ImageInfo(Path.Combine(userDataPath, "profile" + MimeTypes.ToExtension(mimeType)));
await _providerManager