Skip to content

Commit 990d9a3

Browse files
committed
Fix failure to read dangling symlink.
This adds a dangling symlink to the testdata and code to skip reading the file if it's a symlink and can't be read. Signed-off-by: Kevin McDermott <bigkevmcd@gmail.com>
1 parent 0f36bf7 commit 990d9a3

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

internal/update/filereader.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ func (r *ScreeningLocalReader) Read() ([]*yaml.RNode, error) {
101101
// assumes the file is encoded as UTF8.
102102
filebytes, err := os.ReadFile(p)
103103
if err != nil {
104+
if (info.Mode() & os.ModeSymlink) != 0 {
105+
return nil
106+
}
107+
104108
return fmt.Errorf("reading YAML file: %w", err)
105109
}
106110

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
testing.yaml

0 commit comments

Comments
 (0)