Skip to content

Commit

Permalink
Fix ReadFile in kptfileutil to avoid reading Kptfile in wrong directory
Browse files Browse the repository at this point in the history
  • Loading branch information
mortent committed Nov 16, 2020
1 parent d75481e commit 72963ca
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/kptfile/kptfileutil/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func ReadFile(dir string) (kptfile.KptFile, error) {

// if we are in a package subdirectory, find the parent dir with the Kptfile.
// this is necessary to parse the duck-commands for sub-directories of a package
for os.IsNotExist(err) && filepath.Dir(dir) != dir {
for os.IsNotExist(err) && filepath.Base(dir) == kptfile.KptFileName {
dir = filepath.Dir(dir)
f, err = os.Open(filepath.Join(dir, kptfile.KptFileName))
}
Expand Down

0 comments on commit 72963ca

Please sign in to comment.