fix(api): close the user data export reader after download

DownloadUserDataExport obtained an open file reader from
GetUserDataExportFile but never closed it on either the s3 io.Copy or the
http.ServeContent branch, leaking a file descriptor on every download.
Defer the close right after the file is obtained so both branches and the
error paths cover it.
This commit is contained in:
kolaente 2026-06-17 14:25:03 +02:00 committed by kolaente
parent 4b92f23329
commit 02e7a134cc
1 changed files with 1 additions and 0 deletions

View File

@ -131,6 +131,7 @@ func DownloadUserDataExport(c *echo.Context) error {
} }
return err return err
} }
defer func() { _ = exportFile.File.Close() }()
// Downloads must never be cached; no-cache overrides the global no-store // Downloads must never be cached; no-cache overrides the global no-store
// directive while still allowing revalidation. // directive while still allowing revalidation.