Skip to content

Commit

Permalink
feat(disk): simplify DiskCatalog.OpenFile method
Browse files Browse the repository at this point in the history
since `BackwardsCompatiblePaths` func is already
deprecated.

Signed-off-by: Dwi Siswanto <git@dw1.io>
  • Loading branch information
dwisiswant0 committed Dec 16, 2024
1 parent da13a59 commit c464a6c
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions pkg/catalog/disk/catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,7 @@ func NewFSCatalog(fs fs.FS, directory string) *DiskCatalog {
// It is used to read template and payload files based on catalog responses.
func (d *DiskCatalog) OpenFile(filename string) (io.ReadCloser, error) {
if d.templatesFS == nil {
file, err := os.Open(filename)
if err != nil {
if file, errx := os.Open(filename); errx == nil {
return file, nil
}
}
return file, err
return os.Open(filename)
}

return d.templatesFS.Open(filename)
Expand Down

0 comments on commit c464a6c

Please sign in to comment.