add support for a global temp path

Fixes #436
This commit is contained in:
Nicola Murino
2021-05-27 15:38:27 +02:00
parent 7a85c66ee7
commit 3b46e6a6fb
14 changed files with 76 additions and 23 deletions

View File

@@ -226,6 +226,9 @@ func (fs *OsFs) ScanRootDirContents() (int, int64, error) {
// GetAtomicUploadPath returns the path to use for an atomic upload
func (*OsFs) GetAtomicUploadPath(name string) string {
dir := filepath.Dir(name)
if tempPath != "" {
dir = tempPath
}
guid := xid.New().String()
return filepath.Join(dir, ".sftpgo-upload."+guid+"."+filepath.Base(name))
}