diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2023-07-18 20:32:36 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-18 07:32:36 -0500 |
commit | cc73e84fa355fa49e875b2d17319b3da70775e0d (patch) | |
tree | 6ca5241188bfc2f4f1e49060b53e234bc652e1b1 /modules | |
parent | 24b49bcf6615a05cecb77568a1c22ff982141918 (diff) | |
download | gitea-cc73e84fa355fa49e875b2d17319b3da70775e0d.tar.gz gitea-cc73e84fa355fa49e875b2d17319b3da70775e0d.zip |
Avoid creating directories when loading config (#25944)
The "creating dir/file during load config" is a longstanding and complex
problem.
This PR only does a quick patch, it still needs more refactorings in the
future.
Fix #25938
Diffstat (limited to 'modules')
-rw-r--r-- | modules/setting/packages.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/modules/setting/packages.go b/modules/setting/packages.go index dc8d98d29f..b225615a24 100644 --- a/modules/setting/packages.go +++ b/modules/setting/packages.go @@ -74,8 +74,10 @@ func loadPackagesFrom(rootCfg ConfigProvider) (err error) { Packages.ChunkedUploadPath = filepath.ToSlash(filepath.Join(AppDataPath, Packages.ChunkedUploadPath)) } - if err := os.MkdirAll(Packages.ChunkedUploadPath, os.ModePerm); err != nil { - return fmt.Errorf("unable to create chunked upload directory: %s (%v)", Packages.ChunkedUploadPath, err) + if HasInstallLock(rootCfg) { + if err := os.MkdirAll(Packages.ChunkedUploadPath, os.ModePerm); err != nil { + return fmt.Errorf("unable to create chunked upload directory: %s (%v)", Packages.ChunkedUploadPath, err) + } } Packages.LimitTotalOwnerSize = mustBytes(sec, "LIMIT_TOTAL_OWNER_SIZE") |