Merge branch 'feature/disable-exec' of github.com:Start9Labs/filebrowser into feature/disable-exec
This commit is contained in:
commit
9d565c95f5
@ -19,17 +19,16 @@ type Runner struct {
|
|||||||
|
|
||||||
// RunHook runs the hooks for the before and after event.
|
// RunHook runs the hooks for the before and after event.
|
||||||
func (r *Runner) RunHook(fn func() error, evt, path, dst string, user *users.User) error {
|
func (r *Runner) RunHook(fn func() error, evt, path, dst string, user *users.User) error {
|
||||||
if !r.Enabled {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
path = user.FullPath(path)
|
path = user.FullPath(path)
|
||||||
dst = user.FullPath(dst)
|
dst = user.FullPath(dst)
|
||||||
|
|
||||||
if val, ok := r.Commands["before_"+evt]; ok {
|
if r.Enabled {
|
||||||
for _, command := range val {
|
if val, ok := r.Commands["before_"+evt]; ok {
|
||||||
err := r.exec(command, "before_"+evt, path, dst, user)
|
for _, command := range val {
|
||||||
if err != nil {
|
err := r.exec(command, "before_"+evt, path, dst, user)
|
||||||
return err
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -39,11 +38,13 @@ func (r *Runner) RunHook(fn func() error, evt, path, dst string, user *users.Use
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if val, ok := r.Commands["after_"+evt]; ok {
|
if r.Enabled {
|
||||||
for _, command := range val {
|
if val, ok := r.Commands["after_"+evt]; ok {
|
||||||
err := r.exec(command, "after_"+evt, path, dst, user)
|
for _, command := range val {
|
||||||
if err != nil {
|
err := r.exec(command, "after_"+evt, path, dst, user)
|
||||||
return err
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user