Make Golang correctly delete temp files during uploading (#36128)

Fix #36127
This commit is contained in:
wxiaoguang
2025-12-12 02:59:42 +08:00
committed by GitHub
parent 01351cc6c7
commit f25409fab8
7 changed files with 57 additions and 11 deletions

View File

@@ -370,6 +370,10 @@ func loadServerFrom(rootCfg ConfigProvider) {
}
}
// TODO: GOLANG-HTTP-TMPDIR: Some Golang packages (like "http") use os.TempDir() to create temporary files when uploading files.
// So ideally we should set the TMPDIR environment variable to make them use our managed temp directory.
// But there is no clear place to set it currently, for example: when running "install" page, the AppDataPath is not ready yet, then AppDataTempDir won't work
EnableGzip = sec.Key("ENABLE_GZIP").MustBool()
EnablePprof = sec.Key("ENABLE_PPROF").MustBool(false)
PprofDataPath = sec.Key("PPROF_DATA_PATH").MustString(filepath.Join(AppWorkPath, "data/tmp/pprof"))