1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-04-20 00:43:36 +03:00
Octobot/src
Octol1ttle 31968837e5
Fix JSON corruption when saving (#100)
This PR fixes an issue that caused guild data JSON files to be corrupted
upon saving. As it turns out `File.OpenWrite(string)` does not clear the
file before writing to it. That means, if a file contains `{"MyKey":
"MyValue"}` and I write `{}` to it using `File.OpenWrite(string)`, the
contents of the file will be `{}MyKey": "MyValue"}`. This is a malformed
JSON and will cause an error upon next bot startup.

In addition, this PR blacklists the `File.OpenWrite` method using
`CodeAnalysis/BannedSymbols.txt` to prevent its accidental use in the
future.

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
2023-08-22 07:46:57 +00:00
..
Commands Add autocomplete for /editsettings setting keys (#98) 2023-08-22 07:45:46 +00:00
Data Add autocomplete for /editsettings setting keys (#98) 2023-08-22 07:45:46 +00:00
Responders Add a JSON deserialization constructor for ScheduledEventData (#92) 2023-08-15 05:23:58 +00:00
Services Fix JSON corruption when saving (#100) 2023-08-22 07:46:57 +00:00
Boyfriend.cs Add periodic guild data saving (every 5 minutes) (#99) 2023-08-22 07:44:05 +00:00
ColorsList.cs Add a new .editorconfig and reformat code (#76) 2023-08-02 20:51:16 +00:00
Extensions.cs Split GuildUpdateService into separate services (#80) 2023-08-05 18:02:40 +00:00
InteractionResponders.cs Add a new .editorconfig and reformat code (#76) 2023-08-02 20:51:16 +00:00
Messages.Designer.cs Add failed embed for /listremind (#88) 2023-08-14 07:45:56 +00:00