<feed xmlns='http://www.w3.org/2005/Atom'>
<title>jellyfin/tests/Jellyfin.Server.Implementations.Tests/Users/UserManagerProfileImageTests.cs, branch master</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<id>https://git.lodewillems.com/jellyfin/atom?h=master</id>
<link rel='self' href='https://git.lodewillems.com/jellyfin/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.lodewillems.com/jellyfin/'/>
<updated>2026-07-09T11:39:09Z</updated>
<entry>
<title>Fix profile image being impossible to clear when its in-memory key is temporary</title>
<updated>2026-07-09T11:39:09Z</updated>
<author>
<name>TowyTowy</name>
<email>towy@airreps.link</email>
</author>
<published>2026-07-09T11:39:09Z</published>
<link rel='alternate' type='text/html' href='https://git.lodewillems.com/jellyfin/commit/?id=2326ecdedc042f7f1c2ce2a5da409377c09778d7'/>
<id>urn:sha1:2326ecdedc042f7f1c2ce2a5da409377c09778d7</id>
<content type='text'>
ClearProfileImageAsync removed the ProfileImage instance attached to the
passed-in User, but that instance can carry a stale, never-persisted
(temporary) key because UpdateUserAsync creates the persisted image on a
separately loaded entity and never copies the generated key back.
Removing that detached entity on a fresh DbContext made EF Core throw
InvalidOperationException ('ImageInfo.Id has a temporary value'), leaving
the profile image impossible to delete or replace.

Load the tracked, persisted user and remove its actual ProfileImage,
matching the removal pattern already used in UpdateUserAsync. Adds
regression tests covering the temporary-key case and the no-image no-op
(the first fails before this change and passes after).

Fixes #13137

Co-Authored-By: Claude Fable 5 &lt;noreply@anthropic.com&gt;
</content>
</entry>
</feed>
