🚨 fix: gosec lint
This commit is contained in:
parent
7d70d4c4df
commit
db32cdbfae
@ -4,8 +4,10 @@ import (
|
||||
"crypto/md5" // #nosec
|
||||
"encoding/hex"
|
||||
"io"
|
||||
"log"
|
||||
"math/rand"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
@ -96,11 +98,15 @@ func SplitIPAddr(v4v6Bundle string) (string, string, string) {
|
||||
}
|
||||
|
||||
func IsDirEmpty(name string) (bool, error) {
|
||||
f, err := os.Open(name)
|
||||
f, err := os.Open(filepath.Clean(name))
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
defer f.Close()
|
||||
defer func() {
|
||||
if err := f.Close(); err != nil {
|
||||
log.Printf("Error closing file: %s\n", err)
|
||||
}
|
||||
}()
|
||||
|
||||
_, err = f.Readdirnames(1)
|
||||
if err == io.EOF {
|
||||
|
Loading…
Reference in New Issue
Block a user