From 5e420cf5f397b5eb8ad98c19c2cb3e63b521a28c Mon Sep 17 00:00:00 2001 From: MickaelK Date: Thu, 28 Nov 2024 02:03:32 +1100 Subject: [PATCH] fix (config): save config when disk is full before this, if the user had a full disk, there wouldn't be any error reported back whenever editing something in the admin console as file.Close() would return nil .... The only way to go around it is to wait for the sync to be done. --- server/common/config_state.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/common/config_state.go b/server/common/config_state.go index 8ce50074..a3ed45f0 100644 --- a/server/common/config_state.go +++ b/server/common/config_state.go @@ -108,5 +108,9 @@ func SaveConfig(v []byte) error { configStr = val } file.Write(PrettyPrint([]byte(configStr))) + if err = file.Sync(); err != nil { + file.Close() + return err + } return file.Close() }