Skip to content

Commit

Permalink
fix: only concatenating base path if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
evilsocket committed Feb 1, 2021
1 parent 99c3e3a commit 4c0f66f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion feeders/folder.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/evilsocket/islazy/log"
"path"
"path/filepath"
"strings"
)

// Folder is a Feeder that creates a stream from a folder
Expand Down Expand Up @@ -43,7 +44,11 @@ func NewFolderFeeder(conf map[string]string) (Feeder, error) {
func (f *Folder) Start() {
go func() {
for event := range f.watcher.Events {
msg := data.NewMessage(path.Join(f.folderName, event.Name))
fileName := event.Name
if strings.Index(fileName, f.folderName) != 0 {
fileName = path.Join(f.folderName, fileName)
}
msg := data.NewMessage(fileName)
msg.SetExtra("op", event.Op.String())
f.Propagate(msg)
}
Expand Down

0 comments on commit 4c0f66f

Please sign in to comment.