fix mod blacklist update failing if the new version is shorter

Previously `blacklist-update.json` was updated using `File.OpenWrite`, which doesn't truncate before overwriting. If the previous version was longer, that left the longer part at the end of the file.
This commit is contained in:
Jesse Plamondon-Willard
2026-09-13 19:25:10 -04:00
parent 2993301cb9
commit f090df0db3
2 changed files with 2 additions and 1 deletions
+1
View File
@@ -6,6 +6,7 @@
* Improved performance.
* Improved error message when a mod is blocked by Windows Smart App Control.
* Improved translations. Thanks to To2morrow (updated Korean)!
* Fixed rare edge case where a mod blacklist update could fail.
* Updated internal mod blacklist.
* For mod authors:
+1 -1
View File
@@ -1840,7 +1840,7 @@ internal class SCore : IDisposable
// save new file
await using (Stream downloadStream = await newData.AsStream())
await using (FileStream stream = File.OpenWrite(Constants.ApiBlacklistFetchedPath))
await using (FileStream stream = File.Create(Constants.ApiBlacklistFetchedPath))
await downloadStream.CopyToAsync(stream);
this.Monitor.Log($" Mod blacklist updated to match the server (updated from {localHash} to {serverHash}). The changes will take effect on the next SMAPI launch.");