double check if we actually try to open a dir

This commit is contained in:
gempir 2019-08-18 11:08:27 +02:00
parent 67a874606e
commit 13fc592d0a

View file

@ -1,13 +1,12 @@
package archiver
import (
log "github.com/sirupsen/logrus"
"io/ioutil"
"os"
"strconv"
"strings"
"time"
log "github.com/sirupsen/logrus"
)
func (a *Archiver) scanLogPath() {
@ -26,6 +25,7 @@ func (a *Archiver) scanLogPath() {
yearFiles = a.filterFiles(yearFiles)
for _, year := range yearFiles {
if year.IsDir() {
monthFiles, err := ioutil.ReadDir(a.logPath + "/" + channelId.Name() + "/" + year.Name())
if err != nil {
log.Error(err)
@ -34,6 +34,7 @@ func (a *Archiver) scanLogPath() {
monthFiles = a.filterFiles(monthFiles)
for _, month := range monthFiles {
if month.IsDir() {
dayFiles, err := ioutil.ReadDir(a.logPath + "/" + channelId.Name() + "/" + year.Name() + "/" + month.Name())
if err != nil {
log.Error(err)
@ -83,6 +84,9 @@ func (a *Archiver) scanLogPath() {
}
}
}
}
}
}
}