From 8627683f183670a1e377fd7a31e94a2800631db3 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 15 Jul 2016 13:14:20 -0400 Subject: [PATCH] handle duplicate provider ids --- .../Persistence/SqliteItemRepository.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs index 5e09c1d0bd..ca5742edd3 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs @@ -4179,6 +4179,13 @@ namespace MediaBrowser.Server.Implementations.Persistence throw new ArgumentNullException("values"); } + // Just in case there might be case-insensitive duplicates, strip them out now + var newValues = new Dictionary(StringComparer.OrdinalIgnoreCase); + foreach (var pair in values) + { + newValues[pair.Key] = pair.Value; + } + CheckDisposed(); // First delete @@ -4187,7 +4194,7 @@ namespace MediaBrowser.Server.Implementations.Persistence _deleteProviderIdsCommand.ExecuteNonQuery(); - foreach (var pair in values) + foreach (var pair in newValues) { _saveProviderIdsCommand.GetParameter(0).Value = itemId; _saveProviderIdsCommand.GetParameter(1).Value = pair.Key;