From 4d42b5518caa6054b77df934426243216477fbb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=8E=A7=20RicherTunes=20=F0=9F=8E=A7?= Date: Fri, 13 Feb 2026 10:39:13 -0500 Subject: [PATCH] fix(topup): unify whitespace normalization with DuplicationPreventionService TopUpPlanner.NormalizeTopUpKey() used Trim().ToLowerInvariant() while DuplicationPreventionService.NormalizeString() used Regex.Replace(\s+, " ") before lowercasing. This mismatch meant items with multiple internal spaces (e.g. "Lana Del Rey") could bypass top-up deduplication. Align TopUpPlanner to use the same regex whitespace collapse. Co-Authored-By: Claude Opus 4.6 --- Brainarr.Plugin/Services/Core/TopUpPlanner.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Brainarr.Plugin/Services/Core/TopUpPlanner.cs b/Brainarr.Plugin/Services/Core/TopUpPlanner.cs index aa40c729..cf2b628b 100644 --- a/Brainarr.Plugin/Services/Core/TopUpPlanner.cs +++ b/Brainarr.Plugin/Services/Core/TopUpPlanner.cs @@ -155,7 +155,8 @@ private static string NormalizeTopUpKey(string value) return string.Empty; } - return WebUtility.HtmlDecode(value).Trim().ToLowerInvariant(); + var decoded = WebUtility.HtmlDecode(value); + return System.Text.RegularExpressions.Regex.Replace(decoded.Trim(), @"\s+", " ").ToLowerInvariant(); } } }