mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-08 23:28:39 +03:00
eventmanager: add support for global star path matching
This introduce a backward incompatible change for filesystem path matching in the Event Manager, now patterns like "*.txt" will no longer match any file with the "txt" suffix, you need to change them to "/**/*.txt". Also change pre-delete behaviour, now if an error is returned the client will get a permission denied error. This is the same as the other pre-* action. Previously it was not possible to deny deletion of a file. Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -236,7 +236,7 @@ func (c *scpCommand) handleUploadFile(fs vfs.Fs, resolvedPath, filePath string,
|
||||
c.sendErrorMessage(nil, err)
|
||||
return err
|
||||
}
|
||||
err := common.ExecutePreAction(c.connection.BaseConnection, common.OperationPreUpload, resolvedPath, requestPath,
|
||||
_, err := common.ExecutePreAction(c.connection.BaseConnection, common.OperationPreUpload, resolvedPath, requestPath,
|
||||
fileSize, os.O_TRUNC)
|
||||
if err != nil {
|
||||
c.connection.Log(logger.LevelDebug, "upload for file %#v denied by pre action: %v", requestPath, err)
|
||||
@@ -532,7 +532,7 @@ func (c *scpCommand) handleDownload(filePath string) error {
|
||||
return common.ErrPermissionDenied
|
||||
}
|
||||
|
||||
if err := common.ExecutePreAction(c.connection.BaseConnection, common.OperationPreDownload, p, filePath, 0, 0); err != nil {
|
||||
if _, err := common.ExecutePreAction(c.connection.BaseConnection, common.OperationPreDownload, p, filePath, 0, 0); err != nil {
|
||||
c.connection.Log(logger.LevelDebug, "download for file %#v denied by pre action: %v", filePath, err)
|
||||
c.sendErrorMessage(fs, common.ErrPermissionDenied)
|
||||
return common.ErrPermissionDenied
|
||||
|
||||
Reference in New Issue
Block a user