mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-01-23 23:20:51 +01:00
[PR #15071] Fix backdrop image ordering regression in EF Core migration #14050
Labels
No labels
area:database
awaiting-feedback
backend
blocked
breaking change: web api
bug
build
ci
confirmed
discussion needed
dotnet future
downstream
duplicate
EFjellyfin.db
enhancement
feature
future
github-actions
good first issue
hdr
help wanted
invalid
investigation
librarydb
live-tv
lyrics
media playback
music
needs testing
nuget
performance
platform
pull-request
question
regression
release critical
requires-web
roadmap
security
security
stale
support
syncplay
ui & ux
upstream
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: starred/jellyfin#14050
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/jellyfin/jellyfin/pull/15071
Author: @seeyabye
Created: 10/21/2025
Status: 🔄 Open
Base:
release-10.11.z← Head:fix-backdrop-image-ordering📝 Commits (10+)
c8b8cbfFix backdrop image ordering regression after EF Core migration by implementing runtime sorting that matches LocalImageProvider discovery orderf49e632Add database-level SortOrder for backdrop images989cb3cImprove PopulateImageSortOrder migration with async and memory efficiency2b4942dChanged composite index to include ImageType65160f2Prepoluate SortOrder before correctionca5443eChanged SaveImage logicddb641eFixed SortOrder not being populated on new scans6385474Cleanupe90321aFixed SortOrder for Web Uploads1ec2815Fixed AddImage's ordering to ensure consistency📊 Changes
12 files changed (+2380 additions, -30 deletions)
View changed files
📝
Jellyfin.Server.Implementations/Item/BaseItemRepository.cs(+123 -8)➕
Jellyfin.Server/Migrations/Routines/PopulateImageSortOrder.cs(+253 -0)📝
MediaBrowser.Controller/Entities/BaseItem.cs(+95 -19)📝
MediaBrowser.Controller/Entities/ItemImageInfo.cs(+7 -0)📝
MediaBrowser.Controller/Persistence/IItemRepository.cs(+10 -0)➕
MediaBrowser.Controller/Utilities/ImageOrderingUtilities.cs(+53 -0)📝
MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs(+15 -1)📝
src/Jellyfin.Database/Jellyfin.Database.Implementations/Entities/BaseItemImageInfo.cs(+8 -0)➕
src/Jellyfin.Database/Jellyfin.Database.Implementations/ModelConfiguration/BaseItemImageInfoConfiguration.cs(+22 -0)➕
src/Jellyfin.Database/Jellyfin.Database.Providers.Sqlite/Migrations/20251022214259_AddSortOrderToBaseItemImageInfo.Designer.cs(+1724 -0)➕
src/Jellyfin.Database/Jellyfin.Database.Providers.Sqlite/Migrations/20251022214259_AddSortOrderToBaseItemImageInfo.cs(+65 -0)📝
src/Jellyfin.Database/Jellyfin.Database.Providers.Sqlite/Migrations/JellyfinDbModelSnapshot.cs(+5 -2)📄 Description
Issue
After migrating from SQLite direct queries to Entity Framework Core, backdrop images are no longer displayed in the correct order. Specifically,
fanart.jpg(which should have priority) is often displayed after images from theextrafanart/folder.This affects the display when "Select view" is set to "Thumb" or "Thumb Card", the backdrop image shown becomes unpredictable.
Root Cause
In v10.10.7:
In current main (EF Core):
BaseItemImageInfostable without an explicit order columnOrderByclause was specifiedextrafanart/fanart1.jpgsorts beforefanart.jpgalphabeticallySolution
Implements priority-based sorting that matches the
LocalImageProviderdiscovery order:{mediaFileName}-fanart.jpg(highest priority)fanart.jpg(not in extrafanart folder)fanart-N.jpg(numbered backdrops)background.jpg/background-N.jpgart.jpg/art-N.jpgextrafanart/*folder contents (alphabetical)backdrop.jpg/backdropN.jpgWithin each priority group, images are sorted by numeric index (if present) and then alphabetically by path for stability.
Changes
Jellyfin.Server.Implementations/Item/BaseItemRepository.csGetImageOrderPriority()helper method to determine priority based on filename patternsGetNumericImageIndex()helper method to extract numeric indices from filenamesTesting
With a file structure like:
Before:
extrafanart/fanart1.jpgoften displayed firstAfter:
fanart.jpgcorrectly displays first🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.