From e2df01eb1bea2584ae6cd1f50db4a99ed4632eea Mon Sep 17 00:00:00 2001 From: DevMando Date: Mon, 27 Jul 2026 21:20:20 -0700 Subject: [PATCH] Fix gallery background picks showing the previously cached image --- src/MandoCode.Desktop/Services/ThemeManager.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/MandoCode.Desktop/Services/ThemeManager.cs b/src/MandoCode.Desktop/Services/ThemeManager.cs index 27de81d..00eecd3 100644 --- a/src/MandoCode.Desktop/Services/ThemeManager.cs +++ b/src/MandoCode.Desktop/Services/ThemeManager.cs @@ -376,6 +376,11 @@ public static void SetChatBackground(string? sourcePath, string? builtInName = n var dest = Path.Combine(UserDataFolder, "chat-bg" + Path.GetExtension(sourcePath).ToLowerInvariant()); File.Copy(sourcePath, dest, overwrite: true); + // File.Copy keeps the SOURCE's timestamp, and the shipped images all share one + // (git writes them in a single checkout) — so the ?v cache-buster wouldn't change + // between gallery picks and the WebView would keep serving the old image. Stamp + // the copy time to make every pick a fresh URL. + File.SetLastWriteTimeUtc(dest, DateTime.UtcNow); ChatBackgroundFile = dest; } catch { /* unreadable source — behave as if cleared */ }