fix: fix unnecessary changes

Signed-off-by: ronantakizawa <ronantakizawa@gmail.com>
pull/13293/head
ronantakizawa 1 year ago
parent 85403563b3
commit 85d79714bf

@ -68,13 +68,14 @@ func symwalk(path string, info os.FileInfo, walkFn filepath.WalkFunc) error {
resolved, err := filepath.EvalSymlinks(path) resolved, err := filepath.EvalSymlinks(path)
if err != nil { if err != nil {
log.Printf("Skipping broken symlink: %s", path) // Log broken symlink log.Printf("Skipping broken symlink: %s", path) // Log broken symlink
return nil // Skip this symlink and continue return nil
} }
log.Printf("Found symbolic link in path: %s resolves to %s. Contents of linked file included and used", path, resolved) //This log message is to highlight a symlink that is being used within a chart, symlinks can be used for nefarious reasons.
log.Printf("found symbolic link in path: %s resolves to %s. Contents of linked file included and used", path, resolved)
if info, err = os.Lstat(resolved); err != nil { if info, err = os.Lstat(resolved); err != nil {
return err return err
} }
if err := symwalk(path, info, walkFn); err != nil && err != filepath.SkipDir { // Notice we pass the original `path` here if err := symwalk(path, info, walkFn); err != nil && err != filepath.SkipDir {
return err return err
} }
return nil return nil

@ -88,7 +88,6 @@ func Parse(file io.Reader) (*Rules, error) {
// //
// Ignore evaluates path against the rules in order. Evaluation stops when a match // Ignore evaluates path against the rules in order. Evaluation stops when a match
// is found. Matching a negative rule will stop evaluation. // is found. Matching a negative rule will stop evaluation.
// Ignore evaluates the file at the given path, and returns true if it should be ignored.
func (r *Rules) Ignore(path string, fi os.FileInfo) bool { func (r *Rules) Ignore(path string, fi os.FileInfo) bool {
// Don't match on empty dirs. // Don't match on empty dirs.
if path == "" { if path == "" {
@ -129,7 +128,6 @@ func (r *Rules) Ignore(path string, fi os.FileInfo) bool {
} }
} }
return false return false
} }
// parseRule parses a rule string and creates a pattern, which is then stored in the Rules object. // parseRule parses a rule string and creates a pattern, which is then stored in the Rules object.

Loading…
Cancel
Save