From 4332541b3a077e776815e623db707d714e65f04f Mon Sep 17 00:00:00 2001 From: J3vb Date: Fri, 3 Apr 2026 14:45:03 +0200 Subject: [PATCH] fix: return f.Close() error in downloadFile to catch disk-full flush failures --- Server/updater/updater.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Server/updater/updater.go b/Server/updater/updater.go index cdc8301a..02278ec7 100644 --- a/Server/updater/updater.go +++ b/Server/updater/updater.go @@ -762,5 +762,13 @@ func (u *Updater) downloadFile(ctx context.Context, url, destPath string) error } } + // Explicitly close and check the error so a disk-full flush failure is + // not silently swallowed, which would leave a corrupt file on disk. + if err := f.Close(); err != nil { + closed = true + _ = os.Remove(destPath) + return fmt.Errorf("closing downloaded file: %w", err) + } + closed = true return nil }