Don't fail if a file is created in an invalid directory

This commit is contained in:
nemunaire 2016-01-15 19:28:28 +01:00
parent 6af685088e
commit 52fc0af6d0
1 changed files with 5 additions and 1 deletions

View File

@ -87,7 +87,11 @@ func main() {
// Extract
spath := strings.Split(strings.TrimPrefix(ev.Name, SubmissionDir), "/")
go treatSubmission(ev.Name, spath[1], spath[2])
if len(spath) > 2 {
go treatSubmission(ev.Name, spath[1], spath[2])
} else {
log.Println("Invalid new file:", ev.Name)
}
}
case err := <-watcher.Error:
log.Println("error:", err)