mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 06:40:54 +03:00
don't execute fs check if the user has recent activity
The check could be expensive with some backends and is generally only required the first time that a user logs in Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
24
vfs/osfs.go
24
vfs/osfs.go
@@ -128,13 +128,6 @@ func (*OsFs) Mkdir(name string) error {
|
||||
return os.Mkdir(name, os.ModePerm)
|
||||
}
|
||||
|
||||
// MkdirAll creates a directory named path, along with any necessary parents,
|
||||
// and returns nil, or else returns an error.
|
||||
// If path is already a directory, MkdirAll does nothing and returns nil.
|
||||
func (fs *OsFs) MkdirAll(name string, uid int, gid int) error {
|
||||
return fs.createMissingDirs(name, uid, gid)
|
||||
}
|
||||
|
||||
// Symlink creates source as a symbolic link to target.
|
||||
func (*OsFs) Symlink(source, target string) error {
|
||||
return os.Symlink(source, target)
|
||||
@@ -418,23 +411,6 @@ func (fs *OsFs) isSubDir(sub string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (fs *OsFs) createMissingDirs(filePath string, uid, gid int) error {
|
||||
dirsToCreate, err := fs.findNonexistentDirs(filePath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
last := len(dirsToCreate) - 1
|
||||
for i := range dirsToCreate {
|
||||
d := dirsToCreate[last-i]
|
||||
if err := os.Mkdir(d, os.ModePerm); err != nil {
|
||||
fsLog(fs, logger.LevelError, "error creating missing dir: %#v", d)
|
||||
return err
|
||||
}
|
||||
SetPathPermissions(fs, d, uid, gid)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetMimeType returns the content type
|
||||
func (fs *OsFs) GetMimeType(name string) (string, error) {
|
||||
f, err := os.OpenFile(name, os.O_RDONLY, 0)
|
||||
|
||||
Reference in New Issue
Block a user